diff options
Diffstat (limited to 'vere/pkg/noun/jets')
190 files changed, 31833 insertions, 0 deletions
diff --git a/vere/pkg/noun/jets/136/tree.c b/vere/pkg/noun/jets/136/tree.c new file mode 100644 index 0000000..345fe3a --- /dev/null +++ b/vere/pkg/noun/jets/136/tree.c @@ -0,0 +1,1268 @@ +#include "c3/c3.h" +#include "jets.h" +#include "jets/w.h" + + +static c3_c* no_hashes[] = { 0 }; + +static u3j_harm _136_hex_mimes_base16_en_a[] = {{".2", u3we_en_base16}, {}}; +static u3j_harm _136_hex_mimes_base16_de_a[] = {{".2", u3we_de_base16}, {}}; +static u3j_core _136_hex_mimes_base16_d[] = + { { "en", 7, _136_hex_mimes_base16_en_a, 0, no_hashes }, + { "de", 7, _136_hex_mimes_base16_de_a, 0, no_hashes }, + {} + }; +static u3j_core _136_hex_mimes_d[] = + { { "base16", 3, 0, _136_hex_mimes_base16_d, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_ecba_en_a[] = {{".2", u3wea_ecba_en}, {}}; +static u3j_harm _136_hex_aes_ecba_de_a[] = {{".2", u3wea_ecba_de}, {}}; +static u3j_core _136_hex_aes_ecba_d[] = + { { "en", 7, _136_hex_aes_ecba_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_ecba_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_ecbb_en_a[] = {{".2", u3wea_ecbb_en}, {}}; +static u3j_harm _136_hex_aes_ecbb_de_a[] = {{".2", u3wea_ecbb_de}, {}}; +static u3j_core _136_hex_aes_ecbb_d[] = + { { "en", 7, _136_hex_aes_ecbb_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_ecbb_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_ecbc_en_a[] = {{".2", u3wea_ecbc_en}, {}}; +static u3j_harm _136_hex_aes_ecbc_de_a[] = {{".2", u3wea_ecbc_de}, {}}; +static u3j_core _136_hex_aes_ecbc_d[] = + { { "en", 7, _136_hex_aes_ecbc_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_ecbc_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_cbca_en_a[] = {{".2", u3wea_cbca_en}, {}}; +static u3j_harm _136_hex_aes_cbca_de_a[] = {{".2", u3wea_cbca_de}, {}}; +static u3j_core _136_hex_aes_cbca_d[] = + { { "en", 7, _136_hex_aes_cbca_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_cbca_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_cbcb_en_a[] = {{".2", u3wea_cbcb_en}, {}}; +static u3j_harm _136_hex_aes_cbcb_de_a[] = {{".2", u3wea_cbcb_de}, {}}; +static u3j_core _136_hex_aes_cbcb_d[] = + { { "en", 7, _136_hex_aes_cbcb_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_cbcb_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_cbcc_en_a[] = {{".2", u3wea_cbcc_en}, {}}; +static u3j_harm _136_hex_aes_cbcc_de_a[] = {{".2", u3wea_cbcc_de}, {}}; +static u3j_core _136_hex_aes_cbcc_d[] = + { { "en", 7, _136_hex_aes_cbcc_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_cbcc_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_siva_en_a[] = {{".2", u3wea_siva_en}, {}}; +static u3j_harm _136_hex_aes_siva_de_a[] = {{".2", u3wea_siva_de}, {}}; +static u3j_core _136_hex_aes_siva_d[] = + { { "en", 7, _136_hex_aes_siva_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_siva_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_sivb_en_a[] = {{".2", u3wea_sivb_en}, {}}; +static u3j_harm _136_hex_aes_sivb_de_a[] = {{".2", u3wea_sivb_de}, {}}; +static u3j_core _136_hex_aes_sivb_d[] = + { { "en", 7, _136_hex_aes_sivb_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_sivb_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_aes_sivc_en_a[] = {{".2", u3wea_sivc_en}, {}}; +static u3j_harm _136_hex_aes_sivc_de_a[] = {{".2", u3wea_sivc_de}, {}}; +static u3j_core _136_hex_aes_sivc_d[] = + { { "en", 7, _136_hex_aes_sivc_en_a, 0, no_hashes }, + { "de", 7, _136_hex_aes_sivc_de_a, 0, no_hashes }, + {} + }; +static u3j_core _136_hex_aes_d[] = + { { "ecba", 7, 0, _136_hex_aes_ecba_d, no_hashes }, + { "ecbb", 7, 0, _136_hex_aes_ecbb_d, no_hashes }, + { "ecbc", 7, 0, _136_hex_aes_ecbc_d, no_hashes }, + { "cbca", 7, 0, _136_hex_aes_cbca_d, no_hashes }, + { "cbcb", 7, 0, _136_hex_aes_cbcb_d, no_hashes }, + { "cbcc", 7, 0, _136_hex_aes_cbcc_d, no_hashes }, + { "siva", 7, 0, _136_hex_aes_siva_d, no_hashes }, + { "sivb", 7, 0, _136_hex_aes_sivb_d, no_hashes }, + { "sivc", 7, 0, _136_hex_aes_sivc_d, no_hashes }, + {} + }; + +static u3j_harm _136_hex_leer_a[] = {{".2", u3we_leer}, {}}; +static u3j_harm _136_hex_lore_a[] = {{".2", u3we_lore}, {}}; +static u3j_harm _136_hex_loss_a[] = {{".2", u3we_loss}, {}}; +static u3j_harm _136_hex_lune_a[] = {{".2", u3we_lune}, {}}; + + +static u3j_harm _136_hex__adler32_a[] = {{".2", u3we_adler32, c3y}, {}}; +static u3j_core _136_hex__adler_d[] = + { { "adler32", 7, _136_hex__adler32_a, 0, no_hashes }, + {} + }; +static u3j_harm _136_hex__crc32_a[] = {{".2", u3we_crc32}, {}}; +static u3j_core _136_hex__crc_d[] = + { {"crc32", 7, _136_hex__crc32_a, 0, no_hashes }, + {} + }; + +static u3j_core _136_hex_checksum_d[] = + { { "adler", 3, 0, _136_hex__adler_d, no_hashes }, + { "crc", 3, 0, _136_hex__crc_d, no_hashes}, + {} + }; + + +static u3j_harm _136_hex__decompress_zlib_a[] = {{".2", u3we_decompress_zlib}, {}}; +static u3j_harm _136_hex__decompress_gzip_a[] = {{".2", u3we_decompress_gzip}, {}}; +static u3j_core _136_hex__zlib_d[] = { + {"decompress-zlib", 7, _136_hex__decompress_zlib_a, 0, no_hashes }, + {"decompress-gzip", 7, _136_hex__decompress_gzip_a, 0, no_hashes }, + {}}; + + +static u3j_harm _136_hex_coed__ed_scad_a[] = {{".2", u3wee_scad}, {}}; +static u3j_harm _136_hex_coed__ed_scas_a[] = {{".2", u3wee_scas}, {}}; +static u3j_harm _136_hex_coed__ed_scap_a[] = {{".2", u3wee_scap}, {}}; + +static u3j_harm _136_hex_coed__ed_puck_a[] = {{".2", u3wee_puck}, {}}; +static u3j_harm _136_hex_coed__ed_luck_a[] = {{".2", u3wee_luck}, {}}; +static u3j_harm _136_hex_coed__ed_sign_a[] = {{".2", u3wee_sign}, {}}; +static u3j_harm _136_hex_coed__ed_sign_raw_a[] = {{".2", u3wee_sign_raw}, {}}; +static u3j_harm _136_hex_coed__ed_sign_octs_a[] = {{".2", u3wee_sign_octs}, {}}; +static u3j_harm _136_hex_coed__ed_sign_octs_raw_a[] = {{".2", u3wee_sign_octs_raw}, {}}; +static u3j_harm _136_hex_coed__ed_veri_octs_a[] = {{".2", u3wee_veri_octs}, {}}; +static u3j_harm _136_hex_coed__ed_veri_a[] = {{".2", u3wee_veri}, {}}; +static u3j_harm _136_hex_coed__ed_shar_a[] = {{".2", u3wee_shar}, {}}; +static u3j_harm _136_hex_coed__ed_slar_a[] = {{".2", u3wee_slar}, {}}; + +static u3j_harm _136_hex_coed__ed_smac_a[] = + {{".2", u3wee_smac}, {}}; + +static u3j_harm _136_hex_coed__ed_recs_a[] = + {{".2", u3wee_recs}, {}}; + +static u3j_harm _136_hex_coed__ed_point_neg_a[] = + {{".2", u3wee_point_neg}, {}}; + +static u3j_harm _136_hex_coed__ed_point_add_a[] = + {{".2", u3wee_point_add}, {}}; + +static u3j_harm _136_hex_coed__ed_scalarmult_a[] = + {{".2", u3wee_scalarmult}, {}}; + +static u3j_harm _136_hex_coed__ed_scalarmult_base_a[] = + {{".2", u3wee_scalarmult_base}, {}}; + +static u3j_harm _136_hex_coed__ed_add_scalarmult_scalarmult_base_a[] = + {{".2", u3wee_add_scalarmult_scalarmult_base}, {}}; + +static u3j_harm _136_hex_coed__ed_add_double_scalarmult_a[] = + {{".2", u3wee_add_double_scalarmult}, {}}; + +static u3j_core _136_hex_coed__ed_d[] = + { { "sign", 7, _136_hex_coed__ed_sign_a, 0, no_hashes }, + { "sign-raw", 7, _136_hex_coed__ed_sign_raw_a, 0, no_hashes }, + { "sign-octs", 7, _136_hex_coed__ed_sign_octs_a, 0, no_hashes }, + { "sign-octs-raw", 7, _136_hex_coed__ed_sign_octs_raw_a, 0, no_hashes }, + { "puck", 7, _136_hex_coed__ed_puck_a, 0, no_hashes }, + { "luck", 7, _136_hex_coed__ed_luck_a, 0, no_hashes }, + { "scad", 7, _136_hex_coed__ed_scad_a, 0, no_hashes }, + { "scas", 7, _136_hex_coed__ed_scas_a, 0, no_hashes }, + { "scap", 7, _136_hex_coed__ed_scap_a, 0, no_hashes }, + { "veri-octs", 7, _136_hex_coed__ed_veri_octs_a, 0, no_hashes }, + { "veri", 7, _136_hex_coed__ed_veri_a, 0, no_hashes }, + { "shar", 7, _136_hex_coed__ed_shar_a, 0, no_hashes }, + { "slar", 7, _136_hex_coed__ed_slar_a, 0, no_hashes }, + { "point-add", 7, _136_hex_coed__ed_point_add_a, 0, 0 }, + { "point-neg", 7, _136_hex_coed__ed_point_neg_a, 0, 0 }, + { "recs", 7, _136_hex_coed__ed_recs_a, 0, 0 }, + { "smac", 7, _136_hex_coed__ed_smac_a, 0, 0 }, + { "scalarmult", 7, _136_hex_coed__ed_scalarmult_a, 0, + no_hashes }, + { "scalarmult-base", 7, _136_hex_coed__ed_scalarmult_base_a, 0, + no_hashes }, + { "add-scalarmult-scalarmult-base", 7, + _136_hex_coed__ed_add_scalarmult_scalarmult_base_a, 0, + no_hashes }, + { "add-double-scalarmult", 7, + _136_hex_coed__ed_add_double_scalarmult_a, 0, + no_hashes }, + {} + }; + +static u3j_core _136_hex_coed_d[] = + { { "ed", 3, 0, _136_hex_coed__ed_d, no_hashes }, + {} + }; + +static u3j_harm _136_hex_hmac_hmac_a[] = {{".2", u3we_hmac}, {}}; +static u3j_core _136_hex_hmac_d[] = + { { "hmac", 7, _136_hex_hmac_hmac_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_argon2_a[] = {{".2", u3we_argon2}, {}}; +static u3j_core _136_hex_argon_d[] = + { { "argon2", 511, _136_hex_argon2_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_scr_pbk_a[] = {{".2", u3wes_pbk, c3y}, {}}; +static u3j_harm _136_hex_scr_pbl_a[] = {{".2", u3wes_pbl, c3y}, {}}; +static u3j_harm _136_hex_scr_hsh_a[] = {{".2", u3wes_hsh, c3y}, {}}; +static u3j_harm _136_hex_scr_hsl_a[] = {{".2", u3wes_hsl, c3y}, {}}; +static u3j_core _136_hex_scr_d[] = + { { "pbk", 7, _136_hex_scr_pbk_a, 0, no_hashes }, + { "pbl", 7, _136_hex_scr_pbl_a, 0, no_hashes }, + { "hsh", 7, _136_hex_scr_hsh_a, 0, no_hashes }, + { "hsl", 7, _136_hex_scr_hsl_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_secp_secp256k1_make_a[] = {{".2", u3we_make, c3y}, {}}; +static u3j_harm _136_hex_secp_secp256k1_sign_a[] = {{".2", u3we_sign, c3y}, {}}; +static u3j_harm _136_hex_secp_secp256k1_reco_a[] = {{".2", u3we_reco, c3y}, {}}; + +static u3j_harm _136_hex_secp_secp256k1_schnorr_sosi_a[] = + {{".2", u3we_sosi}, {}}; +static u3j_harm _136_hex_secp_secp256k1_schnorr_sove_a[] = + {{".2", u3we_sove}, {}}; +static u3j_core _136_hex_secp_secp256k1_schnorr_d[] = + { { "sosi", 7, + _136_hex_secp_secp256k1_schnorr_sosi_a, 0, + no_hashes }, + { "sove", 7, + _136_hex_secp_secp256k1_schnorr_sove_a, 0, + no_hashes }, + {} + }; + +static u3j_core _136_hex_secp_secp256k1_d[] = + { { "make", 7, _136_hex_secp_secp256k1_make_a, 0, no_hashes }, + { "sign", 7, _136_hex_secp_secp256k1_sign_a, 0, no_hashes }, + { "reco", 7, _136_hex_secp_secp256k1_reco_a, 0, no_hashes }, + { "schnorr", 7, 0, + _136_hex_secp_secp256k1_schnorr_d, + no_hashes }, + {} + }; +static u3j_core _136_hex_secp_d[] = + { { "secp256k1", 3, 0, _136_hex_secp_secp256k1_d, no_hashes }, + {} + }; + + +static u3j_harm _136_hex_kecc_k224_a[] = + {{".2", u3we_kecc224, c3y, c3y, c3y}, {}}; +static u3j_harm _136_hex_kecc_k256_a[] = + {{".2", u3we_kecc256, c3y, c3y, c3y}, {}}; +static u3j_harm _136_hex_kecc_k384_a[] = + {{".2", u3we_kecc384, c3y, c3y, c3y}, {}}; +static u3j_harm _136_hex_kecc_k512_a[] = + {{".2", u3we_kecc512, c3y, c3y, c3y}, {}}; +static u3j_core _136_hex_kecc_d[] = + { { "k224", 7, _136_hex_kecc_k224_a, 0, no_hashes }, + { "k256", 7, _136_hex_kecc_k256_a, 0, no_hashes }, + { "k384", 7, _136_hex_kecc_k384_a, 0, no_hashes }, + { "k512", 7, _136_hex_kecc_k512_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_ripemd_160_a[] = {{".2", u3we_ripe, c3y}, {}}; +static u3j_core _136_hex_ripe_d[] = + { { "ripemd160", 7, _136_hex_ripemd_160_a, 0, no_hashes }, + {} + }; + + + +/* layer five + */ +static u3j_harm _136_pen_cell_a[] = {{".2", u3wf_cell}, {}}; +static u3j_harm _136_pen_comb_a[] = {{".2", u3wf_comb}, {}}; +static u3j_harm _136_pen_cons_a[] = {{".2", u3wf_cons}, {}}; +static u3j_harm _136_pen_core_a[] = {{".2", u3wf_core}, {}}; +static u3j_harm _136_pen_face_a[] = {{".2", u3wf_face}, {}}; +static u3j_harm _136_pen_fitz_a[] = {{".2", u3wf_fitz}, {}}; +static u3j_harm _136_pen_fork_a[] = {{".2", u3wf_fork}, {}}; + +static u3j_harm _136_pen_look_a[] = {{".2", u3wf_look}, {}}; +static u3j_harm _136_pen_loot_a[] = {{".2", u3wf_loot}, {}}; + +static u3j_harm _136_pen__ut_crop_a[] = {{".2", u3wfu_crop}, {}}; +static u3j_harm _136_pen__ut_fish_a[] = {{".2", u3wfu_fish}, {}}; +static u3j_harm _136_pen__ut_fuse_a[] = {{".2", u3wfu_fuse}, {}}; +static u3j_harm _136_pen__ut_redo_a[] = {{".2", u3wfu_redo}, {}}; +static u3j_harm _136_pen__ut_mint_a[] = {{".2", u3wfu_mint}, {}}; +static u3j_harm _136_pen__ut_mull_a[] = {{".2", u3wfu_mull}, {}}; + +static u3j_harm _136_pen__ut_nest_dext_a[] = {{".2", u3wfu_nest_dext}, {}}; +static u3j_core _136_pen__ut_nest_in_d[] = + { + { "nest-dext", 3, _136_pen__ut_nest_dext_a, 0, no_hashes }, + {} + }; +static u3j_core _136_pen__ut_nest_d[] = + { + { "nest-in", 7, 0, _136_pen__ut_nest_in_d, no_hashes }, + {} + }; + +static u3j_harm _136_pen__ut_rest_a[] = {{".2", u3wfu_rest}, {}}; + +static u3j_core _136_pen__ut_d[] = + { + { "crop", 7, _136_pen__ut_crop_a, 0, no_hashes }, + { "fish", 7, _136_pen__ut_fish_a, 0, no_hashes }, + { "fuse", 7, _136_pen__ut_fuse_a, 0, no_hashes }, + { "redo", 7, _136_pen__ut_redo_a, 0, no_hashes }, + { "mint", 7, _136_pen__ut_mint_a, 0, no_hashes }, + { "mull", 7, _136_pen__ut_mull_a, 0, no_hashes }, + { "nest", 7, 0, _136_pen__ut_nest_d, no_hashes }, + { "rest", 7, _136_pen__ut_rest_a, 0, no_hashes }, + {} + }; + +static u3j_hood _136_pen__ut_ho[] = + { { "ar", 12282 }, + { "fan", 28, c3n }, + { "rib", 58, c3n }, + { "vet", 59, c3n }, + + { "blow", 6015 }, + { "burp", 342 }, + { "busk", 1363 }, + { "buss", 374 }, + { "crop", 1494 }, + { "duck", 1524 }, + { "dune", 2991 }, + { "dunk", 3066 }, + { "epla", 12206 }, + { "emin", 1534 }, + { "emul", 6134 }, + { "feel", 1502 }, + { "felt", 94 }, + { "fine", 49086 }, + { "fire", 4 }, + { "fish", 6006 }, + { "fond", 12283 }, + { "fund", 6014 }, + // XX +funk is not part of +ut, and this hook appears to be unused + // remove from here and the +ut hint + // + { "funk", 0xbefafa, c3y, 31 }, + { "fuse", 24021 }, + { "gain", 380 }, + { "lose", 0x2fefe }, + { "mile", 382 }, + { "mine", 372 }, + { "mint", 49083 }, + { "moot", 0x2feff }, + { "mull", 24020 }, + { "nest", 92 }, + { "peel", 1526 }, + { "play", 3006 }, + { "peek", 1532 }, + { "repo", 22 }, + { "rest", 6102 }, + { "tack", 6007 }, + { "toss", 24540 }, + { "wrap", 6136 }, + {}, + }; + + +static u3j_hood _136_pen_ho[] = { + { "ap", 22 }, + { "ut", 86 }, + {}, +}; + + +/* layer four + */ +static u3j_harm _136_qua_trip_a[] = {{".2", u3we_trip}, {}}; + +static u3j_harm _136_qua_slaw_a[] = {{".2", u3we_slaw}, {}}; +static u3j_harm _136_qua_scot_a[] = {{".2", u3we_scot}, {}}; +static u3j_harm _136_qua_scow_a[] = {{".2", u3we_scow}, {}}; + +static u3j_harm _136_qua__po_ind_a[] = {{".2", u3wcp_ind}, {}}; +static u3j_harm _136_qua__po_ins_a[] = {{".2", u3wcp_ins}, {}}; +static u3j_harm _136_qua__po_tod_a[] = {{".2", u3wcp_tod}, {}}; +static u3j_harm _136_qua__po_tos_a[] = {{".2", u3wcp_tos}, {}}; +static u3j_core _136_qua__po_d[] = + { { "ind", 7, _136_qua__po_ind_a, 0, no_hashes }, + { "ins", 7, _136_qua__po_ins_a, 0, no_hashes }, + { "tod", 7, _136_qua__po_tod_a, 0, no_hashes }, + { "tos", 7, _136_qua__po_tos_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__bend_fun_a[] = {{".2", u3we_bend_fun}, {}}; +static u3j_core _136_qua__bend_d[] = + { { "fun", 7, _136_qua__bend_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__cold_fun_a[] = {{".2", u3we_cold_fun}, {}}; +static u3j_core _136_qua__cold_d[] = + { { "fun", 7, _136_qua__cold_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__cook_fun_a[] = {{".2", u3we_cook_fun}, {}}; +static u3j_core _136_qua__cook_d[] = + { { "fun", 7, _136_qua__cook_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__comp_fun_a[] = {{".2", u3we_comp_fun}, {}}; +static u3j_core _136_qua__comp_d[] = + { { "fun", 7, _136_qua__comp_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__easy_fun_a[] = {{".2", u3we_easy_fun}, {}}; +static u3j_core _136_qua__easy_d[] = + { { "fun", 7, _136_qua__easy_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__glue_fun_a[] = {{".2", u3we_glue_fun}, {}}; +static u3j_core _136_qua__glue_d[] = + { { "fun", 7, _136_qua__glue_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__here_fun_a[] = {{".2", u3we_here_fun}, {}}; +static u3j_core _136_qua__here_d[] = + { { "fun", 7, _136_qua__here_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__just_fun_a[] = {{".2", u3we_just_fun}, {}}; +static u3j_core _136_qua__just_d[] = + { { "fun", 7, _136_qua__just_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__mask_fun_a[] = {{".2", u3we_mask_fun}, {}}; +static u3j_core _136_qua__mask_d[] = + { { "fun", 7, _136_qua__mask_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__shim_fun_a[] = {{".2", u3we_shim_fun}, {}}; +static u3j_core _136_qua__shim_d[] = + { { "fun", 7, _136_qua__shim_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__stag_fun_a[] = {{".2", u3we_stag_fun}, {}}; +static u3j_core _136_qua__stag_d[] = + { { "fun", 7, _136_qua__stag_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__stew_fun_a[] = {{".2", u3we_stew_fun}, {}}; +static u3j_core _136_qua__stew_d[] = + { { "fun", 31, _136_qua__stew_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua__stir_fun_a[] = {{".2", u3we_stir_fun}, {}}; +static u3j_core _136_qua__stir_d[] = + { { "fun", 7, _136_qua__stir_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_qua_pfix_a[] = {{".2", u3we_pfix}, {}}; + +static u3j_harm _136_qua_plug_a[] = {{".2", u3we_plug}, {}}; +static u3j_harm _136_qua_pose_a[] = {{".2", u3we_pose}, {}}; + +static u3j_harm _136_qua_sfix_a[] = {{".2", u3we_sfix}, {}}; + +static u3j_harm _136_qua_mink_a[] = {{".2", u3we_mink}, {}}; +static u3j_harm _136_qua_mole_a[] = {{".2", u3we_mole}, {}}; +static u3j_harm _136_qua_mule_a[] = {{".2", u3we_mule}, {}}; + + +static u3j_hood _136_qua_ho[] = { + { "show", 188 }, + {}, +}; + + +/* layer three + */ +static u3j_harm _136_tri__cofl__drg_a[] = {{".2", u3wef_drg}, {}}; +static u3j_harm _136_tri__cofl__lug_a[] = {{".2", u3wef_lug}, {}}; +static u3j_core _136_tri__cofl_d[] = + { { "drg", 7, _136_tri__cofl__drg_a, 0, no_hashes }, + { "lug", 7, _136_tri__cofl__lug_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri__rd_add_a[] = {{".2", u3wer_add}, {}}; +static u3j_harm _136_tri__rd_sub_a[] = {{".2", u3wer_sub}, {}}; +static u3j_harm _136_tri__rd_mul_a[] = {{".2", u3wer_mul}, {}}; +static u3j_harm _136_tri__rd_div_a[] = {{".2", u3wer_div}, {}}; +static u3j_harm _136_tri__rd_sqt_a[] = {{".2", u3wer_sqt}, {}}; +static u3j_harm _136_tri__rd_fma_a[] = {{".2", u3wer_fma}, {}}; +static u3j_harm _136_tri__rd_lth_a[] = {{".2", u3wer_lth}, {}}; +static u3j_harm _136_tri__rd_lte_a[] = {{".2", u3wer_lte}, {}}; +static u3j_harm _136_tri__rd_equ_a[] = {{".2", u3wer_equ}, {}}; +static u3j_harm _136_tri__rd_gte_a[] = {{".2", u3wer_gte}, {}}; +static u3j_harm _136_tri__rd_gth_a[] = {{".2", u3wer_gth}, {}}; +static u3j_core _136_tri__rd_d[] = + { { "add", 7, _136_tri__rd_add_a, 0, no_hashes }, + { "sub", 7, _136_tri__rd_sub_a, 0, no_hashes }, + { "mul", 7, _136_tri__rd_mul_a, 0, no_hashes }, + { "div", 7, _136_tri__rd_div_a, 0, no_hashes }, + { "sqt", 7, _136_tri__rd_sqt_a, 0, no_hashes }, + { "fma", 7, _136_tri__rd_fma_a, 0, no_hashes }, + { "lth", 7, _136_tri__rd_lth_a, 0, no_hashes }, + { "lte", 7, _136_tri__rd_lte_a, 0, no_hashes }, + { "equ", 7, _136_tri__rd_equ_a, 0, no_hashes }, + { "gte", 7, _136_tri__rd_gte_a, 0, no_hashes }, + { "gth", 7, _136_tri__rd_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri__rs_add_a[] = {{".2", u3wet_add}, {}}; +static u3j_harm _136_tri__rs_sub_a[] = {{".2", u3wet_sub}, {}}; +static u3j_harm _136_tri__rs_mul_a[] = {{".2", u3wet_mul}, {}}; +static u3j_harm _136_tri__rs_div_a[] = {{".2", u3wet_div}, {}}; +static u3j_harm _136_tri__rs_sqt_a[] = {{".2", u3wet_sqt}, {}}; +static u3j_harm _136_tri__rs_fma_a[] = {{".2", u3wet_fma}, {}}; +static u3j_harm _136_tri__rs_lth_a[] = {{".2", u3wet_lth}, {}}; +static u3j_harm _136_tri__rs_lte_a[] = {{".2", u3wet_lte}, {}}; +static u3j_harm _136_tri__rs_equ_a[] = {{".2", u3wet_equ}, {}}; +static u3j_harm _136_tri__rs_gte_a[] = {{".2", u3wet_gte}, {}}; +static u3j_harm _136_tri__rs_gth_a[] = {{".2", u3wet_gth}, {}}; +static u3j_core _136_tri__rs_d[] = + { { "add", 7, _136_tri__rs_add_a, 0, no_hashes }, + { "sub", 7, _136_tri__rs_sub_a, 0, no_hashes }, + { "mul", 7, _136_tri__rs_mul_a, 0, no_hashes }, + { "div", 7, _136_tri__rs_div_a, 0, no_hashes }, + { "sqt", 7, _136_tri__rs_sqt_a, 0, no_hashes }, + { "fma", 7, _136_tri__rs_fma_a, 0, no_hashes }, + { "lth", 7, _136_tri__rs_lth_a, 0, no_hashes }, + { "lte", 7, _136_tri__rs_lte_a, 0, no_hashes }, + { "equ", 7, _136_tri__rs_equ_a, 0, no_hashes }, + { "gte", 7, _136_tri__rs_gte_a, 0, no_hashes }, + { "gth", 7, _136_tri__rs_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri__rq_add_a[] = {{".2", u3weq_add}, {}}; +static u3j_harm _136_tri__rq_sub_a[] = {{".2", u3weq_sub}, {}}; +static u3j_harm _136_tri__rq_mul_a[] = {{".2", u3weq_mul}, {}}; +static u3j_harm _136_tri__rq_div_a[] = {{".2", u3weq_div}, {}}; +static u3j_harm _136_tri__rq_sqt_a[] = {{".2", u3weq_sqt}, {}}; +static u3j_harm _136_tri__rq_fma_a[] = {{".2", u3weq_fma}, {}}; +static u3j_harm _136_tri__rq_lth_a[] = {{".2", u3weq_lth}, {}}; +static u3j_harm _136_tri__rq_lte_a[] = {{".2", u3weq_lte}, {}}; +static u3j_harm _136_tri__rq_equ_a[] = {{".2", u3weq_equ}, {}}; +static u3j_harm _136_tri__rq_gte_a[] = {{".2", u3weq_gte}, {}}; +static u3j_harm _136_tri__rq_gth_a[] = {{".2", u3weq_gth}, {}}; +static u3j_core _136_tri__rq_d[] = + { { "add", 7, _136_tri__rq_add_a, 0, no_hashes }, + { "sub", 7, _136_tri__rq_sub_a, 0, no_hashes }, + { "mul", 7, _136_tri__rq_mul_a, 0, no_hashes }, + { "div", 7, _136_tri__rq_div_a, 0, no_hashes }, + { "sqt", 7, _136_tri__rq_sqt_a, 0, no_hashes }, + { "fma", 7, _136_tri__rq_fma_a, 0, no_hashes }, + { "lth", 7, _136_tri__rq_lth_a, 0, no_hashes }, + { "lte", 7, _136_tri__rq_lte_a, 0, no_hashes }, + { "equ", 7, _136_tri__rq_equ_a, 0, no_hashes }, + { "gte", 7, _136_tri__rq_gte_a, 0, no_hashes }, + { "gth", 7, _136_tri__rq_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri__rh_add_a[] = {{".2", u3wes_add}, {}}; +static u3j_harm _136_tri__rh_sub_a[] = {{".2", u3wes_sub}, {}}; +static u3j_harm _136_tri__rh_mul_a[] = {{".2", u3wes_mul}, {}}; +static u3j_harm _136_tri__rh_div_a[] = {{".2", u3wes_div}, {}}; +static u3j_harm _136_tri__rh_sqt_a[] = {{".2", u3wes_sqt}, {}}; +static u3j_harm _136_tri__rh_fma_a[] = {{".2", u3wes_fma}, {}}; +static u3j_harm _136_tri__rh_lth_a[] = {{".2", u3wes_lth}, {}}; +static u3j_harm _136_tri__rh_lte_a[] = {{".2", u3wes_lte}, {}}; +static u3j_harm _136_tri__rh_equ_a[] = {{".2", u3wes_equ}, {}}; +static u3j_harm _136_tri__rh_gte_a[] = {{".2", u3wes_gte}, {}}; +static u3j_harm _136_tri__rh_gth_a[] = {{".2", u3wes_gth}, {}}; +static u3j_core _136_tri__rh_d[] = + { { "add", 7, _136_tri__rh_add_a, 0, no_hashes }, + { "sub", 7, _136_tri__rh_sub_a, 0, no_hashes }, + { "mul", 7, _136_tri__rh_mul_a, 0, no_hashes }, + { "div", 7, _136_tri__rh_div_a, 0, no_hashes }, + { "sqt", 7, _136_tri__rh_sqt_a, 0, no_hashes }, + { "fma", 7, _136_tri__rh_fma_a, 0, no_hashes }, + { "lth", 7, _136_tri__rh_lth_a, 0, no_hashes }, + { "lte", 7, _136_tri__rh_lte_a, 0, no_hashes }, + { "equ", 7, _136_tri__rh_equ_a, 0, no_hashes }, + { "gte", 7, _136_tri__rh_gte_a, 0, no_hashes }, + { "gth", 7, _136_tri__rh_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri__og_raw_a[] = {{".2", u3weo_raw}, {}}; +static u3j_core _136_tri__og_d[] = + { { "raw", 7, _136_tri__og_raw_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri__sha_sha1_a[] = {{".2", u3we_sha1}, {}}; +static u3j_core _136_tri__sha_d[] = + { { "sha1", 7, _136_tri__sha_sha1_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_tri_shax_a[] = {{".2", u3we_shax}, {}}; +static u3j_harm _136_tri_shay_a[] = {{".2", u3we_shay}, {}}; +static u3j_harm _136_tri_shas_a[] = {{".2", u3we_shas}, {}}; +static u3j_harm _136_tri_shal_a[] = {{".2", u3we_shal}, {}}; + +static u3j_harm _136_ob_fynd_a[] = {{".2", u3we_fynd_ob}, {}}; +static u3j_harm _136_ob_fein_a[] = {{".2", u3we_fein_ob}, {}}; +static u3j_core _136_ob_d[] = { + { "fein", 7, _136_ob_fein_a, 0, no_hashes }, + { "fynd", 7, _136_ob_fynd_a, 0, no_hashes }, + {} +}; +static u3j_hood _136_ob_ho[] = { + { "fein", 42 }, + { "fynd", 20 }, + {}, +}; + + +static u3j_hood _136_tri_ho[] = { + { "ob", 20 }, + { "yore", 5462 }, + { "year", 44975 }, + {}, +}; + + +/* layer two + */ +static u3j_harm _136_two_find_a[] = {{".2", u3wb_find, c3y}, {}}; +static u3j_harm _136_two_flop_a[] = {{".2", u3wb_flop, c3y}, {}}; +static u3j_harm _136_two_lent_a[] = {{".2", u3wb_lent, c3y}, {}}; +static u3j_harm _136_two_levy_a[] = {{".2", u3wb_levy, c3y}, {}}; +static u3j_harm _136_two_lien_a[] = {{".2", u3wb_lien, c3y}, {}}; +static u3j_harm _136_two_murn_a[] = {{".2", u3wb_murn, c3y}, {}}; +static u3j_harm _136_two_need_a[] = {{".2", u3wb_need, c3y}, {}}; +static u3j_harm _136_two_reap_a[] = {{".2", u3wb_reap, c3y}, {}}; +static u3j_harm _136_two_reel_a[] = {{".2", u3wb_reel, c3y}, {}}; +static u3j_harm _136_two_roll_a[] = {{".2", u3wb_roll, c3y}, {}}; +static u3j_harm _136_two_skid_a[] = {{".2", u3wb_skid, c3y}, {}}; +static u3j_harm _136_two_skim_a[] = {{".2", u3wb_skim, c3y}, {}}; +static u3j_harm _136_two_skip_a[] = {{".2", u3wb_skip, c3y}, {}}; +static u3j_harm _136_two_scag_a[] = {{".2", u3wb_scag, c3y}, {}}; +static u3j_harm _136_two_slag_a[] = {{".2", u3wb_slag, c3y}, {}}; +static u3j_harm _136_two_snag_a[] = {{".2", u3wb_snag, c3y}, {}}; +static u3j_harm _136_two_sort_a[] = {{".2", u3wb_sort, c3y}, {}}; +static u3j_harm _136_two_turn_a[] = {{".2", u3wb_turn, c3y}, {}}; +static u3j_harm _136_two_weld_a[] = {{".2", u3wb_weld, c3y}, {}}; +static u3j_harm _136_two_welp_a[] = {{".2", u3wb_welp, c3y}, {}}; +static u3j_harm _136_two_zing_a[] = {{".2", u3wb_zing, c3y}, {}}; + +static u3j_harm _136_two_bex_a[] = {{".2", u3wc_bex, c3y}, {}}; +static u3j_harm _136_two_can_a[] = {{".2", u3wc_can, c3y}, {}}; +static u3j_harm _136_two_cat_a[] = {{".2", u3wc_cat, c3y}, {}}; +static u3j_harm _136_two_con_a[] = {{".2", u3wc_con, c3y}, {}}; +static u3j_harm _136_two_cut_a[] = {{".2", u3wc_cut, c3y}, {}}; +static u3j_harm _136_two_dis_a[] = {{".2", u3wc_dis, c3y}, {}}; +static u3j_harm _136_two_dor_a[] = {{".2", u3wc_dor, c3y}, {}}; +static u3j_harm _136_two_end_a[] = {{".2", u3wc_end, c3y}, {}}; +static u3j_harm _136_two_gor_a[] = {{".2", u3wc_gor, c3y}, {}}; +static u3j_harm _136_two_lsh_a[] = {{".2", u3wc_lsh, c3y}, {}}; +static u3j_harm _136_two_met_a[] = {{".2", u3wc_met, c3y}, {}}; +static u3j_harm _136_two_mix_a[] = {{".2", u3wc_mix, c3y}, {}}; +static u3j_harm _136_two_mor_a[] = {{".2", u3wc_mor, c3y}, {}}; +static u3j_harm _136_two_mug_a[] = {{".2", u3wc_mug, c3y}, {}}; +static u3j_harm _136_two_muk_a[] = {{".2", u3wc_muk, c3y}, {}}; +static u3j_harm _136_two_pow_a[] = {{".2", u3wc_pow, c3y}, {}}; +static u3j_harm _136_two_rap_a[] = {{".2", u3wc_rap, c3y}, {}}; +static u3j_harm _136_two_rep_a[] = {{".2", u3wc_rep, c3y}, {}}; +static u3j_harm _136_two_rev_a[] = {{".2", u3wc_rev, c3y}, {}}; +static u3j_harm _136_two_rip_a[] = {{".2", u3wc_rip, c3y}, {}}; +static u3j_harm _136_two_rsh_a[] = {{".2", u3wc_rsh, c3y}, {}}; +static u3j_harm _136_two_swp_a[] = {{".2", u3wc_swp, c3y}, {}}; +static u3j_harm _136_two_sqt_a[] = {{".2", u3wc_sqt, c3y}, {}}; +static u3j_harm _136_two_xeb_a[] = {{".2", u3wc_xeb, c3y}, {}}; + +static u3j_harm _136_two__in_bif_a[] = {{".2", u3wdi_bif}, {}}; +static u3j_harm _136_two__in_del_a[] = {{".2", u3wdi_del}, {}}; +static u3j_harm _136_two__in_dif_a[] = {{".2", u3wdi_dif}, {}}; +static u3j_harm _136_two__in_gas_a[] = {{".2", u3wdi_gas}, {}}; +static u3j_harm _136_two__in_has_a[] = {{".2", u3wdi_has}, {}}; +static u3j_harm _136_two__in_int_a[] = {{".2", u3wdi_int}, {}}; +static u3j_harm _136_two__in_put_a[] = {{".2", u3wdi_put}, {}}; +static u3j_harm _136_two__in_rep_a[] = {{".2", u3wdi_rep}, {}}; +static u3j_harm _136_two__in_run_a[] = {{".2", u3wdi_run}, {}}; +static u3j_harm _136_two__in_tap_a[] = {{".2", u3wdi_tap}, {}}; +static u3j_harm _136_two__in_wyt_a[] = {{".2", u3wdi_wyt}, {}}; +static u3j_harm _136_two__in_uni_a[] = {{".2", u3wdi_uni}, {}}; + +static u3j_harm _136_two__by_all_a[] = {{".2", u3wdb_all, c3y}, {}}; +static u3j_harm _136_two__by_any_a[] = {{".2", u3wdb_any, c3y}, {}}; +static u3j_harm _136_two__by_apt_a[] = {{".2", u3wdb_apt, c3y}, {}}; + +static u3j_harm _136_two__by_del_a[] = {{".2", u3wdb_del, c3y}, {}}; +static u3j_harm _136_two__by_dif_a[] = {{".2", u3wdb_dif, c3y}, {}}; +static u3j_harm _136_two__by_gas_a[] = {{".2", u3wdb_gas, c3y}, {}}; +static u3j_harm _136_two__by_get_a[] = {{".2", u3wdb_get, c3y}, {}}; +static u3j_harm _136_two__by_has_a[] = {{".2", u3wdb_has, c3y}, {}}; +static u3j_harm _136_two__by_int_a[] = {{".2", u3wdb_int, c3y}, {}}; +static u3j_harm _136_two__by_jab_a[] = {{".2", u3wdb_jab, c3y}, {}}; +static u3j_harm _136_two__by_key_a[] = {{".2", u3wdb_key, c3y}, {}}; +static u3j_harm _136_two__by_put_a[] = {{".2", u3wdb_put, c3y}, {}}; +static u3j_harm _136_two__by_rep_a[] = {{".2", u3wdb_rep, c3y}, {}}; +static u3j_harm _136_two__by_run_a[] = {{".2", u3wdb_run, c3y}, {}}; +static u3j_harm _136_two__by_tap_a[] = {{".2", u3wdb_tap, c3y}, {}}; +static u3j_harm _136_two__by_uni_a[] = {{".2", u3wdb_uni, c3y}, {}}; +static u3j_harm _136_two__by_urn_a[] = {{".2", u3wdb_urn, c3y}, {}}; +static u3j_harm _136_two__by_wyt_a[] = {{".2", u3wdb_wyt, c3y}, {}}; + +static u3j_harm _136_two_cue_a[] = {{".2", u3we_cue}, {}}; +static u3j_harm _136_two_jam_a[] = {{".2", u3we_jam}, {}}; +static u3j_harm _136_two_mat_a[] = {{".2", u3we_mat}, {}}; +static u3j_harm _136_two_rub_a[] = {{".2", u3we_rub}, {}}; + + + +/* layer one + */ +static u3j_harm _136_one_add_a[] = {{".2", u3wa_add, c3y}, {}}; +static u3j_harm _136_one_dec_a[] = {{".2", u3wa_dec, c3y}, {}}; +static u3j_harm _136_one_div_a[] = {{".2", u3wa_div, c3y}, {}}; +static u3j_harm _136_one_dvr_a[] = {{".2", u3wc_dvr, c3y}, {}}; +static u3j_harm _136_one_gte_a[] = {{".2", u3wa_gte, c3y}, {}}; +static u3j_harm _136_one_gth_a[] = {{".2", u3wa_gth, c3y}, {}}; +static u3j_harm _136_one_lte_a[] = {{".2", u3wa_lte, c3y}, {}}; +static u3j_harm _136_one_lth_a[] = {{".2", u3wa_lth, c3y}, {}}; +static u3j_harm _136_one_max_a[] = {{".2", u3wa_max, c3y}, {}}; +static u3j_harm _136_one_min_a[] = {{".2", u3wa_min, c3y}, {}}; +static u3j_harm _136_one_mod_a[] = {{".2", u3wa_mod, c3y}, {}}; +static u3j_harm _136_one_mul_a[] = {{".2", u3wa_mul, c3y}, {}}; +static u3j_harm _136_one_sub_a[] = {{".2", u3wa_sub, c3y}, {}}; + +static u3j_harm _136_one_cap_a[] = {{".2", u3wc_cap, c3y}, {}}; +static u3j_harm _136_one_peg_a[] = {{".2", u3wc_peg, c3y}, {}}; +static u3j_harm _136_one_mas_a[] = {{".2", u3wc_mas, c3y}, {}}; + +static u3j_harm _136_lull_plot_fax_a[] = {{".2", u3wg_plot_fax, c3y}, {}}; +static u3j_harm _136_lull_plot_met_a[] = {{".2", u3wg_plot_met, c3y}, {}}; + +static u3j_core _136_lull_plot_d[] = + { { "fax", 7, _136_lull_plot_fax_a, 0, no_hashes }, + { "met", 7, _136_lull_plot_met_a, 0, no_hashes }, + {} + }; + +static u3j_core _136_lull_d[] = + { { "plot", 31, 0, _136_lull_plot_d, no_hashes }, + {} + }; + +static u3j_harm _136_hex_blake3_hash_a[] = {{".2", u3we_blake3_hash, c3y}, {}}; +static u3j_harm _136_hex_blake3_compress_a[] = {{".2", u3we_blake3_compress, c3y}, {}}; +static u3j_harm _136_hex_blake3_chunk_output_a[] = {{".2", u3we_blake3_chunk_output, c3y}, {}}; + +static u3j_core _136_hex_blake3_d[] = + { { "hash", 7, _136_hex_blake3_hash_a, 0, no_hashes }, + { "chunk-output", 7, _136_hex_blake3_chunk_output_a, 0, no_hashes }, + {} + }; + + +static u3j_core _136_hex_blake3_impl_d[] = + { { "compress", 7, _136_hex_blake3_compress_a, 0, no_hashes }, + { "blake3", 7, 0, _136_hex_blake3_d, no_hashes }, + {} + }; + +static u3j_harm _136_hex_blake2b_a[] = {{".2", u3we_blake2b, c3y}, {}}; + +static u3j_core _136_hex_blake_d[] = + { { "blake2b", 7, _136_hex_blake2b_a, 0, no_hashes }, + { "blake3-impl", 7, 0, _136_hex_blake3_impl_d, no_hashes }, + {} + }; + + +static u3j_harm _136_hex_chacha_crypt_a[] = {{".2", u3we_chacha_crypt, c3y}, {}}; +static u3j_harm _136_hex_chacha_xchacha_a[] = {{".2", u3we_chacha_xchacha, c3y}, {}}; +static u3j_core _136_hex_chacha_d[] = + { { "crypt", 7, _136_hex_chacha_crypt_a, 0, no_hashes }, + { "xchacha", 7, _136_hex_chacha_xchacha_a, 0, no_hashes }, + {} + }; + + +//+| %utilities +static u3j_harm _136_hex_bytestream_rip_octs_a[] = {{".2", u3we_bytestream_rip_octs, c3y}, {}}; +static u3j_harm _136_hex_bytestream_cat_octs_a[] = {{".2", u3we_bytestream_cat_octs, c3y}, {}}; +static u3j_harm _136_hex_bytestream_can_octs_a[] = {{".2", u3we_bytestream_can_octs, c3y}, {}}; +//+| %read-byte +static u3j_harm _136_hex_bytestream_read_byte_a[] = {{".2", u3we_bytestream_read_byte, c3y}, {}}; +//+| %read-octs +static u3j_harm _136_hex_bytestream_read_octs_a[] = {{".2", u3we_bytestream_read_octs, c3y}, {}}; +//+| %navigation +static u3j_harm _136_hex_bytestream_skip_line_a[] = {{".2", u3we_bytestream_skip_line, c3y}, {}}; +static u3j_harm _136_hex_bytestream_find_byte_a[] = {{".2", u3we_bytestream_find_byte, c3y}, {}}; +static u3j_harm _136_hex_bytestream_seek_byte_a[] = {{".2", u3we_bytestream_seek_byte, c3y}, {}}; +//+| %transformation +static u3j_harm _136_hex_bytestream_chunk_a[] = {{".2", u3we_bytestream_chunk}, {}}; +static u3j_harm _136_hex_bytestream_extract_a[] = {{".2", u3we_bytestream_extract}, {}}; +static u3j_harm _136_hex_bytestream_fuse_extract_a[] = {{".2", u3we_bytestream_fuse_extract}, {}}; +//+| %bitstream +static u3j_harm _136_hex_bytestream_need_bits_a[] = {{".2", u3we_bytestream_need_bits}, {}}; +static u3j_harm _136_hex_bytestream_drop_bits_a[] = {{".2", u3we_bytestream_drop_bits}, {}}; +// static u3j_harm _136_hex_bytestream_skip_bits_a[] = {{".2", u3we_bytestream_skip_bits}, {}}; +static u3j_harm _136_hex_bytestream_peek_bits_a[] = {{".2", u3we_bytestream_peek_bits}, {}}; +static u3j_harm _136_hex_bytestream_read_bits_a[] = {{".2", u3we_bytestream_read_bits}, {}}; +// static u3j_harm _136_hex_bytestream_read_need_bits_a[] = {{".2", u3we_bytestream_read_need_bits}, {}}; +static u3j_harm _136_hex_bytestream_byte_bits_a[] = {{".2", u3we_bytestream_byte_bits}, {}}; + +static u3j_core _136_hex_bytestream_d[] = + { //+| %utilities + {"rip-octs", 7, _136_hex_bytestream_rip_octs_a, 0, no_hashes }, + {"cat-octs", 7, _136_hex_bytestream_cat_octs_a, 0, no_hashes }, + {"can-octs", 7, _136_hex_bytestream_can_octs_a, 0, no_hashes }, + //+| %navigation + {"skip-line", 7, _136_hex_bytestream_skip_line_a, 0, no_hashes }, + {"find-byte", 7, _136_hex_bytestream_find_byte_a, 0, no_hashes }, + {"seek-byte", 7, _136_hex_bytestream_seek_byte_a, 0, no_hashes }, + //+| %read-byte + {"read-byte", 7, _136_hex_bytestream_read_byte_a, 0, no_hashes }, + //+| %read-octs + {"read-octs", 7, _136_hex_bytestream_read_octs_a, 0, no_hashes }, + //+| %transformation + {"chunk", 7, _136_hex_bytestream_chunk_a, 0, no_hashes }, + {"extract", 7, _136_hex_bytestream_extract_a, 0, no_hashes }, + {"fuse-extract", 7, _136_hex_bytestream_fuse_extract_a, 0, no_hashes }, + //+| %bitstream + {"need-bits", 7, _136_hex_bytestream_need_bits_a, 0, no_hashes }, + {"drop-bits", 7, _136_hex_bytestream_drop_bits_a, 0, no_hashes }, + // {"skip-bits", 7, _136_hex_bytestream_skip_bits_a, 0, no_hashes }, + {"peek-bits", 7, _136_hex_bytestream_peek_bits_a, 0, no_hashes }, + {"read-bits", 7, _136_hex_bytestream_read_bits_a, 0, no_hashes }, + // {"read-need-bits", 7, _136_hex_bytestream_read_need_bits_a, 0, no_hashes }, + {"byte-bits", 7, _136_hex_bytestream_byte_bits_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_hex_json_de_a[] = {{".2", u3we_json_de}, {}}; +static u3j_harm _136_hex_json_en_a[] = {{".2", u3we_json_en}, {}}; +static u3j_core _136_hex_json_d[] = + { { "de", 15, _136_hex_json_de_a, 0, no_hashes }, + { "en", 15, _136_hex_json_en_a, 0, no_hashes }, + {} + }; + +/* /lib jets in non core +*/ +static u3j_harm _136_non__lagoon_add_a[] = {{".2", u3wi_la_add}, {}}; +static u3j_harm _136_non__lagoon_sub_a[] = {{".2", u3wi_la_sub}, {}}; +static u3j_harm _136_non__lagoon_mul_a[] = {{".2", u3wi_la_mul}, {}}; +static u3j_harm _136_non__lagoon_div_a[] = {{".2", u3wi_la_div}, {}}; +static u3j_harm _136_non__lagoon_mod_a[] = {{".2", u3wi_la_mod}, {}}; +static u3j_harm _136_non__lagoon_adds_a[] = {{".2", u3wi_la_adds}, {}}; +static u3j_harm _136_non__lagoon_subs_a[] = {{".2", u3wi_la_subs}, {}}; +static u3j_harm _136_non__lagoon_muls_a[] = {{".2", u3wi_la_muls}, {}}; +static u3j_harm _136_non__lagoon_divs_a[] = {{".2", u3wi_la_divs}, {}}; +static u3j_harm _136_non__lagoon_mods_a[] = {{".2", u3wi_la_mods}, {}}; +static u3j_harm _136_non__lagoon_dot_a[] = {{".2", u3wi_la_dot}, {}}; +static u3j_harm _136_non__lagoon_trans_a[] ={{".2", u3wi_la_transpose}, {}}; +static u3j_harm _136_non__lagoon_cumsum_a[]={{".2", u3wi_la_cumsum}, {}}; +static u3j_harm _136_non__lagoon_argmin_a[]={{".2", u3wi_la_argmin}, {}}; +static u3j_harm _136_non__lagoon_argmax_a[]={{".2", u3wi_la_argmax}, {}}; +static u3j_harm _136_non__lagoon_ravel_a[]={{".2", u3wi_la_ravel}, {}}; +static u3j_harm _136_non__lagoon_min_a[] = {{".2", u3wi_la_min}, {}}; +static u3j_harm _136_non__lagoon_max_a[] = {{".2", u3wi_la_max}, {}}; +static u3j_harm _136_non__lagoon_linspace_a[]={{".2", u3wi_la_linspace}, {}}; +static u3j_harm _136_non__lagoon_range_a[]= {{".2", u3wi_la_range}, {}}; +static u3j_harm _136_non__lagoon_abs_a[] = {{".2", u3wi_la_abs}, {}}; +static u3j_harm _136_non__lagoon_gth_a[] = {{".2", u3wi_la_gth}, {}}; +static u3j_harm _136_non__lagoon_gte_a[] = {{".2", u3wi_la_gte}, {}}; +static u3j_harm _136_non__lagoon_lth_a[] = {{".2", u3wi_la_lth}, {}}; +static u3j_harm _136_non__lagoon_lte_a[] = {{".2", u3wi_la_lte}, {}}; +static u3j_harm _136_non__lagoon_diag_a[] = {{".2", u3wi_la_diag}, {}}; +static u3j_harm _136_non__lagoon_trace_a[]= {{".2", u3wi_la_trace}, {}}; +static u3j_harm _136_non__lagoon_mmul_a[] = {{".2", u3wi_la_mmul}, {}}; +static u3j_harm _136_non__mice_a[] = {{".2", u3we_mice}, {}}; + +static u3j_core _136_non__la_core_d[] = + { { "add-rays", 7, _136_non__lagoon_add_a, 0, no_hashes }, + { "sub-rays", 7, _136_non__lagoon_sub_a, 0, no_hashes }, + { "mul-rays", 7, _136_non__lagoon_mul_a, 0, no_hashes }, + { "div-rays", 7, _136_non__lagoon_div_a, 0, no_hashes }, + { "mod-rays", 7, _136_non__lagoon_mod_a, 0, no_hashes }, + { "add-scal", 7, _136_non__lagoon_adds_a, 0, no_hashes }, + { "sub-scal", 7, _136_non__lagoon_subs_a, 0, no_hashes }, + { "mul-scal", 7, _136_non__lagoon_muls_a, 0, no_hashes }, + { "div-scal", 7, _136_non__lagoon_divs_a, 0, no_hashes }, + { "mod-scal", 7, _136_non__lagoon_mods_a, 0, no_hashes }, + { "dot", 7, _136_non__lagoon_dot_a, 0, no_hashes }, + { "transpose",7, _136_non__lagoon_trans_a, 0, no_hashes }, + { "cumsum", 7, _136_non__lagoon_cumsum_a, 0, no_hashes }, + { "argmin", 7, _136_non__lagoon_argmin_a, 0, no_hashes }, + { "argmax", 7, _136_non__lagoon_argmax_a, 0, no_hashes }, + { "ravel", 7, _136_non__lagoon_ravel_a, 0, no_hashes }, + { "min", 7, _136_non__lagoon_min_a, 0, no_hashes }, + { "max", 7, _136_non__lagoon_max_a, 0, no_hashes }, + { "linspace", 7, _136_non__lagoon_linspace_a, 0, no_hashes }, + { "range", 7, _136_non__lagoon_range_a, 0, no_hashes }, + { "abs", 7, _136_non__lagoon_abs_a, 0, no_hashes }, + { "gth", 7, _136_non__lagoon_gth_a, 0, no_hashes }, + { "gte", 7, _136_non__lagoon_gte_a, 0, no_hashes }, + { "lth", 7, _136_non__lagoon_lth_a, 0, no_hashes }, + { "lte", 7, _136_non__lagoon_lte_a, 0, no_hashes }, + { "diag", 7, _136_non__lagoon_diag_a, 0, no_hashes }, + { "trace", 7, _136_non__lagoon_trace_a,0, no_hashes }, + { "mmul", 7, _136_non__lagoon_mmul_a, 0, no_hashes }, + {} + }; + +static u3j_core _136_non_d[] = + { { "lagoon", 7, 0, _136_non__la_core_d, no_hashes }, + { "mice", 7, _136_non__mice_a, 0, no_hashes }, + {} + }; + + +static u3j_harm _136_hex_lia_run_v1_a[] = {{".2", u3we_lia_run_v1, c3y}, {}}; + +static u3j_harm _136_hex_lia_run_once_inner_a[] = {{".2", u3we_lia_run_once, c3y}, {}}; + +static u3j_core _136_hex_lia_run_once_d[] = { + { "run-once-inner-v0", 15, _136_hex_lia_run_once_inner_a, 0, no_hashes }, + {} +}; + +static u3j_core _136_hex_lia_monad_d[] = { + { "run-v1", 7, _136_hex_lia_run_v1_a, 0, no_hashes }, + { "run-once-v0", 7, 0, _136_hex_lia_run_once_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_wasm_engine_d[] = { + { "monad-v0", 3, 0, _136_hex_lia_monad_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_wasm_op_def_d[] = { + { "wasm-engine-v0", 3, 0, _136_hex_wasm_engine_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_wasm_validator_d[] = { + { "wasm-op-def-v0", 3, 0, _136_hex_wasm_op_def_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_wasm_parser_d[] = { + { "validator-v0", 3, 0, _136_hex_wasm_validator_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_lia_sur_d[] = { + { "wasm-parser-v0", 3, 0, _136_hex_wasm_parser_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_wasm_engine_sur_d[] = { + { "monad-sur-v1", 3, 0, _136_hex_lia_sur_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_wasm_sur_d[] = { + { "engine-sur-v0", 3, 0, _136_hex_wasm_engine_sur_d, no_hashes }, + {} +}; + +static u3j_core _136_hex_d[] = + { { "non", 7, 0, _136_non_d, no_hashes }, + + { "lull", 3, 0, _136_lull_d, no_hashes }, + + { "lore", 63, _136_hex_lore_a, 0, no_hashes }, + + { "leer", 63, _136_hex_leer_a, 0, no_hashes }, + { "loss", 63, _136_hex_loss_a, 0, no_hashes }, + { "lune", 127, _136_hex_lune_a, 0, no_hashes }, + + { "crc", 31, 0, _136_hex__crc_d, no_hashes }, + + { "coed", 63, 0, _136_hex_coed_d, no_hashes }, + { "aes", 31, 0, _136_hex_aes_d, no_hashes }, + + { "hmac", 63, 0, _136_hex_hmac_d, no_hashes }, + { "argon", 31, 0, _136_hex_argon_d, no_hashes }, + { "blake", 31, 0, _136_hex_blake_d, no_hashes }, + { "chacha", 31, 0, _136_hex_chacha_d, no_hashes }, + { "kecc", 31, 0, _136_hex_kecc_d, no_hashes }, + { "ripemd", 31, 0, _136_hex_ripe_d, no_hashes }, + { "scr", 31, 0, _136_hex_scr_d, no_hashes }, + { "secp", 6, 0, _136_hex_secp_d, no_hashes }, + { "mimes", 31, 0, _136_hex_mimes_d, no_hashes }, + { "json", 31, 0, _136_hex_json_d, no_hashes }, + { "checksum", 15, 0, _136_hex_checksum_d, no_hashes}, + { "wasm-sur-v0", 3, 0, _136_hex_wasm_sur_d, no_hashes }, + { "bytestream-v0", 31, 0, _136_hex_bytestream_d, no_hashes}, + { "zlib-v0", 31, 0, _136_hex__zlib_d, no_hashes }, + {} + }; + +static u3j_core _136_pen_d[] = + { { "hex", 7, 0, _136_hex_d, no_hashes }, + + { "cell", 7, _136_pen_cell_a, 0, no_hashes }, + { "comb", 7, _136_pen_comb_a, 0, no_hashes }, + { "cons", 7, _136_pen_cons_a, 0, no_hashes }, + { "core", 7, _136_pen_core_a, 0, no_hashes }, + { "face", 7, _136_pen_face_a, 0, no_hashes }, + { "fitz", 7, _136_pen_fitz_a, 0, no_hashes }, + { "fork", 7, _136_pen_fork_a, 0, no_hashes }, + { "look", 7, _136_pen_look_a, 0, no_hashes }, + { "loot", 7, _136_pen_loot_a, 0, no_hashes }, + { "ut", 15, 0, _136_pen__ut_d, no_hashes, _136_pen__ut_ho }, + {} + }; + +static u3j_core _136_qua__vi_d[] = + { + { "mole", 7, _136_qua_mole_a, 0, no_hashes }, + { "mule", 7, _136_qua_mule_a, 0, no_hashes }, + {} + }; + +static u3j_core _136_qua_d[] = + { { "pen", 3, 0, _136_pen_d, no_hashes, _136_pen_ho }, + + { "po", 7, 0, _136_qua__po_d, no_hashes }, + + { "trip", 7, _136_qua_trip_a, 0, no_hashes }, + + { "bend", 7, 0, _136_qua__bend_d, no_hashes }, + { "cold", 7, 0, _136_qua__cold_d, no_hashes }, + { "comp", 7, 0, _136_qua__comp_d, no_hashes }, + { "cook", 7, 0, _136_qua__cook_d, no_hashes }, + { "easy", 7, 0, _136_qua__easy_d, no_hashes }, + { "glue", 7, 0, _136_qua__glue_d, no_hashes }, + { "here", 7, 0, _136_qua__here_d, no_hashes }, + { "just", 7, 0, _136_qua__just_d, no_hashes }, + { "mask", 7, 0, _136_qua__mask_d, no_hashes }, + { "shim", 7, 0, _136_qua__shim_d, no_hashes }, + { "stag", 7, 0, _136_qua__stag_d, no_hashes }, + { "stew", 7, 0, _136_qua__stew_d, no_hashes }, + { "stir", 7, 0, _136_qua__stir_d, no_hashes }, + + { "pfix", 7, _136_qua_pfix_a, 0, no_hashes }, + { "plug", 7, _136_qua_plug_a, 0, no_hashes }, + { "pose", 7, _136_qua_pose_a, 0, no_hashes }, + { "sfix", 7, _136_qua_sfix_a, 0, no_hashes }, + + { "mink", 7, _136_qua_mink_a, 0, no_hashes }, + { "vi", 7, 0, _136_qua__vi_d, no_hashes }, + + { "scot", 7, _136_qua_scot_a, 0, no_hashes }, + { "scow", 7, _136_qua_scow_a, 0, no_hashes }, + { "slaw", 7, _136_qua_slaw_a, 0, no_hashes }, + {} + }; + +static u3j_core _136_tri_d[] = + { { "qua", 3, 0, _136_qua_d, no_hashes, _136_qua_ho }, + + { "cofl", 7, 0, _136_tri__cofl_d, no_hashes }, + { "rd", 7, 0, _136_tri__rd_d, no_hashes }, + { "rs", 7, 0, _136_tri__rs_d, no_hashes }, + { "rq", 7, 0, _136_tri__rq_d, no_hashes }, + { "rh", 7, 0, _136_tri__rh_d, no_hashes }, + { "og", 7, 0, _136_tri__og_d, no_hashes }, + + { "sha", 7, 0, _136_tri__sha_d, no_hashes }, + { "shax", 7, _136_tri_shax_a, 0, no_hashes }, + { "shay", 7, _136_tri_shay_a, 0, no_hashes }, + { "shas", 7, _136_tri_shas_a, 0, no_hashes }, + { "shal", 7, _136_tri_shal_a, 0, no_hashes }, + + { "ob", 3, 0, _136_ob_d, no_hashes, _136_ob_ho }, + {} + }; + +static u3j_harm _136_two_clz_a[] = {{".2", u3wc_clz, c3n}, {}}; +static u3j_harm _136_two_ctz_a[] = {{".2", u3wc_ctz, c3n}, {}}; +static u3j_harm _136_two_ham_a[] = {{".2", u3wc_ham, c3n}, {}}; + +static u3j_harm _136_two__hew_fun_a[] = {{".2", u3wc_hew, c3n}, {}}; +static u3j_core _136_two__hew_d[] = + { { "fun", 15, _136_two__hew_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_two__by_bif_a[] = {{".2", u3wdb_bif, c3y}, {}}; + +static u3j_core _136_two__by_d[] = + { { "all", 7, _136_two__by_all_a, 0, no_hashes }, + { "any", 7, _136_two__by_any_a, 0, no_hashes }, + { "apt", 7, _136_two__by_apt_a, 0, no_hashes }, + { "bif", 7, _136_two__by_bif_a, 0, no_hashes }, + { "del", 7, _136_two__by_del_a, 0, no_hashes }, + { "dif", 7, _136_two__by_dif_a, 0, no_hashes }, + { "gas", 7, _136_two__by_gas_a, 0, no_hashes }, + { "get", 7, _136_two__by_get_a, 0, no_hashes }, + { "has", 7, _136_two__by_has_a, 0, no_hashes }, + { "int", 7, _136_two__by_int_a, 0, no_hashes }, + { "jab", 7, _136_two__by_jab_a, 0, no_hashes }, + { "key", 7, _136_two__by_key_a, 0, no_hashes }, + { "put", 7, _136_two__by_put_a, 0, no_hashes }, + { "rep", 7, _136_two__by_rep_a, 0, no_hashes }, + { "run", 7, _136_two__by_run_a, 0, no_hashes }, + { "tap", 7, _136_two__by_tap_a, 0, no_hashes }, + { "uni", 7, _136_two__by_uni_a, 0, no_hashes }, + { "urn", 7, _136_two__by_urn_a, 0, no_hashes }, + { "wyt", 3, _136_two__by_wyt_a, 0, no_hashes }, + {} + }; + + +static u3j_harm _136_two__in_apt_a[] = {{".2", u3wdi_apt}, {}}; + +static u3j_core _136_two__in_d[] = + { { "apt", 7, _136_two__in_apt_a, 0, no_hashes }, + { "bif", 7, _136_two__in_bif_a, 0, no_hashes }, + { "del", 7, _136_two__in_del_a, 0, no_hashes }, + { "dif", 7, _136_two__in_dif_a, 0, no_hashes }, + { "gas", 7, _136_two__in_gas_a, 0, no_hashes }, + { "has", 7, _136_two__in_has_a, 0, no_hashes }, + { "int", 7, _136_two__in_int_a, 0, no_hashes }, + { "put", 7, _136_two__in_put_a, 0, no_hashes }, + { "rep", 7, _136_two__in_rep_a, 0, no_hashes }, + { "run", 7, _136_two__in_run_a, 0, no_hashes }, + { "tap", 7, _136_two__in_tap_a, 0, no_hashes }, + { "uni", 7, _136_two__in_uni_a, 0, no_hashes }, + { "wyt", 3, _136_two__in_wyt_a, 0, no_hashes }, + {} + }; + +static u3j_harm _136_two_rig_a[] = {{".2", u3wc_rig, c3n}, {}}; + +static u3j_harm _136_two_mate_a[] = {{".2", u3wb_mate, c3y}, {}}; +static u3j_harm _136_two_sew_a[] = {{".2", u3wc_sew, c3y}, {}}; + +static u3j_core _136_two_d[] = + { { "tri", 3, 0, _136_tri_d, no_hashes, _136_tri_ho }, + + { "find", 7, _136_two_find_a, 0, no_hashes }, + { "flop", 7, _136_two_flop_a, 0, no_hashes }, + { "lent", 7, _136_two_lent_a, 0, no_hashes }, + { "levy", 7, _136_two_levy_a, 0, no_hashes }, + { "lien", 7, _136_two_lien_a, 0, no_hashes }, + { "murn", 7, _136_two_murn_a, 0, no_hashes }, + { "need", 7, _136_two_need_a, 0, no_hashes }, + { "mate", 7, _136_two_mate_a, 0, no_hashes }, + { "reap", 7, _136_two_reap_a, 0, no_hashes }, + { "reel", 7, _136_two_reel_a, 0, no_hashes }, + { "roll", 7, _136_two_roll_a, 0, no_hashes }, + { "skid", 7, _136_two_skid_a, 0, no_hashes }, + { "skim", 7, _136_two_skim_a, 0, no_hashes }, + { "skip", 7, _136_two_skip_a, 0, no_hashes }, + { "scag", 7, _136_two_scag_a, 0, no_hashes }, + { "slag", 7, _136_two_slag_a, 0, no_hashes }, + { "snag", 7, _136_two_snag_a, 0, no_hashes }, + { "sort", 7, _136_two_sort_a, 0, no_hashes }, + { "turn", 7, _136_two_turn_a, 0, no_hashes }, + { "weld", 7, _136_two_weld_a, 0, no_hashes }, + { "welp", 7, _136_two_welp_a, 0, no_hashes }, + { "zing", 7, _136_two_zing_a, 0, no_hashes }, + + { "bex", 7, _136_two_bex_a, 0, no_hashes }, + { "cat", 7, _136_two_cat_a, 0, no_hashes }, + { "can", 7, _136_two_can_a, 0, no_hashes }, + { "clz", 7, _136_two_clz_a, 0, no_hashes }, + { "con", 7, _136_two_con_a, 0, no_hashes }, + { "ctz", 7, _136_two_ctz_a, 0, no_hashes }, + { "cue", 7, _136_two_cue_a, 0, no_hashes }, + { "cut", 7, _136_two_cut_a, 0, no_hashes }, + { "dis", 7, _136_two_dis_a, 0, no_hashes }, + { "dor", 7, _136_two_dor_a, 0, no_hashes }, + { "end", 7, _136_two_end_a, 0, no_hashes }, + { "gor", 7, _136_two_gor_a, 0, no_hashes }, + { "ham", 7, _136_two_ham_a, 0, no_hashes }, + { "hew", 7, 0, _136_two__hew_d, no_hashes }, + { "jam", 7, _136_two_jam_a, 0, no_hashes }, + { "lsh", 7, _136_two_lsh_a, 0, no_hashes }, + { "mat", 7, _136_two_mat_a, 0, no_hashes }, + { "met", 7, _136_two_met_a, 0, no_hashes }, + { "mix", 7, _136_two_mix_a, 0, no_hashes }, + { "mor", 7, _136_two_mor_a, 0, no_hashes }, + { "mug", 7, _136_two_mug_a, 0, no_hashes }, + { "muk", 7, _136_two_muk_a, 0, no_hashes }, + { "rap", 7, _136_two_rap_a, 0, no_hashes }, + { "rep", 7, _136_two_rep_a, 0, no_hashes }, + { "rev", 7, _136_two_rev_a, 0, no_hashes }, + { "rig", 7, _136_two_rig_a, 0, no_hashes }, + { "rip", 7, _136_two_rip_a, 0, no_hashes }, + { "rsh", 7, _136_two_rsh_a, 0, no_hashes }, + { "swp", 7, _136_two_swp_a, 0, no_hashes }, + { "rub", 7, _136_two_rub_a, 0, no_hashes }, + { "pow", 7, _136_two_pow_a, 0, no_hashes }, + { "sew", 7, _136_two_sew_a, 0, no_hashes }, + { "sqt", 7, _136_two_sqt_a, 0, no_hashes }, + { "xeb", 7, _136_two_xeb_a, 0, no_hashes }, + + { "by", 7, 0, _136_two__by_d, no_hashes }, + { "in", 7, 0, _136_two__in_d, no_hashes }, + {} + }; + +static u3j_core _136_one_d[] = + { { "two", 3, 0, _136_two_d, no_hashes }, + + { "add", 7, _136_one_add_a, 0, no_hashes }, + { "dec", 7, _136_one_dec_a, 0, no_hashes }, + { "div", 7, _136_one_div_a, 0, no_hashes }, + { "dvr", 7, _136_one_dvr_a, 0, no_hashes }, + { "gte", 7, _136_one_gte_a, 0, no_hashes }, + { "gth", 7, _136_one_gth_a, 0, no_hashes }, + { "lte", 7, _136_one_lte_a, 0, no_hashes }, + { "lth", 7, _136_one_lth_a, 0, no_hashes }, + { "max", 7, _136_one_max_a, 0, no_hashes }, + { "min", 7, _136_one_min_a, 0, no_hashes }, + { "mod", 7, _136_one_mod_a, 0, no_hashes }, + { "mul", 7, _136_one_mul_a, 0, no_hashes }, + { "sub", 7, _136_one_sub_a, 0, no_hashes }, + + { "cap", 7, _136_one_cap_a, 0, no_hashes }, + { "mas", 7, _136_one_mas_a, 0, no_hashes }, + { "peg", 7, _136_one_peg_a, 0, no_hashes }, + {} + }; + +u3j_core _k136_d[] = + { { "one", 3, 0, _136_one_d, no_hashes }, + {} + }; + diff --git a/vere/pkg/noun/jets/137/tree.c b/vere/pkg/noun/jets/137/tree.c new file mode 100644 index 0000000..9564135 --- /dev/null +++ b/vere/pkg/noun/jets/137/tree.c @@ -0,0 +1,1184 @@ +#include "c3/c3.h" +#include "jets.h" +#include "jets/w.h" + + +static c3_c* no_hashes[] = { 0 }; + +static u3j_harm _137_hex_mimes_base16_en_a[] = {{".2", u3we_en_base16}, {}}; +static u3j_harm _137_hex_mimes_base16_de_a[] = {{".2", u3we_de_base16}, {}}; +static u3j_core _137_hex_mimes_base16_d[] = + { { "en", 7, _137_hex_mimes_base16_en_a, 0, no_hashes }, + { "de", 7, _137_hex_mimes_base16_de_a, 0, no_hashes }, + {} + }; +static u3j_core _137_hex_mimes_d[] = + { { "base16", 3, 0, _137_hex_mimes_base16_d, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_ecba_en_a[] = {{".2", u3wea_ecba_en}, {}}; +static u3j_harm _137_hex_aes_ecba_de_a[] = {{".2", u3wea_ecba_de}, {}}; +static u3j_core _137_hex_aes_ecba_d[] = + { { "en", 7, _137_hex_aes_ecba_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_ecba_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_ecbb_en_a[] = {{".2", u3wea_ecbb_en}, {}}; +static u3j_harm _137_hex_aes_ecbb_de_a[] = {{".2", u3wea_ecbb_de}, {}}; +static u3j_core _137_hex_aes_ecbb_d[] = + { { "en", 7, _137_hex_aes_ecbb_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_ecbb_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_ecbc_en_a[] = {{".2", u3wea_ecbc_en}, {}}; +static u3j_harm _137_hex_aes_ecbc_de_a[] = {{".2", u3wea_ecbc_de}, {}}; +static u3j_core _137_hex_aes_ecbc_d[] = + { { "en", 7, _137_hex_aes_ecbc_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_ecbc_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_cbca_en_a[] = {{".2", u3wea_cbca_en}, {}}; +static u3j_harm _137_hex_aes_cbca_de_a[] = {{".2", u3wea_cbca_de}, {}}; +static u3j_core _137_hex_aes_cbca_d[] = + { { "en", 7, _137_hex_aes_cbca_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_cbca_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_cbcb_en_a[] = {{".2", u3wea_cbcb_en}, {}}; +static u3j_harm _137_hex_aes_cbcb_de_a[] = {{".2", u3wea_cbcb_de}, {}}; +static u3j_core _137_hex_aes_cbcb_d[] = + { { "en", 7, _137_hex_aes_cbcb_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_cbcb_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_cbcc_en_a[] = {{".2", u3wea_cbcc_en}, {}}; +static u3j_harm _137_hex_aes_cbcc_de_a[] = {{".2", u3wea_cbcc_de}, {}}; +static u3j_core _137_hex_aes_cbcc_d[] = + { { "en", 7, _137_hex_aes_cbcc_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_cbcc_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_siva_en_a[] = {{".2", u3wea_siva_en}, {}}; +static u3j_harm _137_hex_aes_siva_de_a[] = {{".2", u3wea_siva_de}, {}}; +static u3j_core _137_hex_aes_siva_d[] = + { { "en", 7, _137_hex_aes_siva_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_siva_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_sivb_en_a[] = {{".2", u3wea_sivb_en}, {}}; +static u3j_harm _137_hex_aes_sivb_de_a[] = {{".2", u3wea_sivb_de}, {}}; +static u3j_core _137_hex_aes_sivb_d[] = + { { "en", 7, _137_hex_aes_sivb_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_sivb_de_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_aes_sivc_en_a[] = {{".2", u3wea_sivc_en}, {}}; +static u3j_harm _137_hex_aes_sivc_de_a[] = {{".2", u3wea_sivc_de}, {}}; +static u3j_core _137_hex_aes_sivc_d[] = + { { "en", 7, _137_hex_aes_sivc_en_a, 0, no_hashes }, + { "de", 7, _137_hex_aes_sivc_de_a, 0, no_hashes }, + {} + }; +static u3j_core _137_hex_aes_d[] = + { { "ecba", 7, 0, _137_hex_aes_ecba_d, no_hashes }, + { "ecbb", 7, 0, _137_hex_aes_ecbb_d, no_hashes }, + { "ecbc", 7, 0, _137_hex_aes_ecbc_d, no_hashes }, + { "cbca", 7, 0, _137_hex_aes_cbca_d, no_hashes }, + { "cbcb", 7, 0, _137_hex_aes_cbcb_d, no_hashes }, + { "cbcc", 7, 0, _137_hex_aes_cbcc_d, no_hashes }, + { "siva", 7, 0, _137_hex_aes_siva_d, no_hashes }, + { "sivb", 7, 0, _137_hex_aes_sivb_d, no_hashes }, + { "sivc", 7, 0, _137_hex_aes_sivc_d, no_hashes }, + {} + }; + +static u3j_harm _137_hex_leer_a[] = {{".2", u3we_leer}, {}}; +static u3j_harm _137_hex_lore_a[] = {{".2", u3we_lore}, {}}; +static u3j_harm _137_hex_loss_a[] = {{".2", u3we_loss}, {}}; +static u3j_harm _137_hex_lune_a[] = {{".2", u3we_lune}, {}}; + + +static u3j_harm _137_hex__crc32_a[] = {{".2", u3we_crc32}, {}}; + +static u3j_core _137_hex__crc_d[] = {{"crc32", 7, _137_hex__crc32_a, 0, no_hashes }, {}}; + + +static u3j_harm _137_hex_coed__ed_scad_a[] = {{".2", u3wee_scad}, {}}; +static u3j_harm _137_hex_coed__ed_scas_a[] = {{".2", u3wee_scas}, {}}; +static u3j_harm _137_hex_coed__ed_scap_a[] = {{".2", u3wee_scap}, {}}; + +static u3j_harm _137_hex_coed__ed_puck_a[] = {{".2", u3wee_puck}, {}}; +static u3j_harm _137_hex_coed__ed_luck_a[] = {{".2", u3wee_luck}, {}}; +static u3j_harm _137_hex_coed__ed_sign_a[] = {{".2", u3wee_sign}, {}}; +static u3j_harm _137_hex_coed__ed_sign_raw_a[] = {{".2", u3wee_sign_raw}, {}}; +static u3j_harm _137_hex_coed__ed_sign_octs_a[] = {{".2", u3wee_sign_octs}, {}}; +static u3j_harm _137_hex_coed__ed_sign_octs_raw_a[] = {{".2", u3wee_sign_octs_raw}, {}}; +static u3j_harm _137_hex_coed__ed_veri_octs_a[] = {{".2", u3wee_veri_octs}, {}}; +static u3j_harm _137_hex_coed__ed_veri_a[] = {{".2", u3wee_veri}, {}}; +static u3j_harm _137_hex_coed__ed_shar_a[] = {{".2", u3wee_shar}, {}}; +static u3j_harm _137_hex_coed__ed_slar_a[] = {{".2", u3wee_slar}, {}}; + +static u3j_harm _137_hex_coed__ed_smac_a[] = + {{".2", u3wee_smac}, {}}; + +static u3j_harm _137_hex_coed__ed_recs_a[] = + {{".2", u3wee_recs}, {}}; + +static u3j_harm _137_hex_coed__ed_point_neg_a[] = + {{".2", u3wee_point_neg}, {}}; + +static u3j_harm _137_hex_coed__ed_point_add_a[] = + {{".2", u3wee_point_add}, {}}; + +static u3j_harm _137_hex_coed__ed_scalarmult_a[] = + {{".2", u3wee_scalarmult}, {}}; + +static u3j_harm _137_hex_coed__ed_scalarmult_base_a[] = + {{".2", u3wee_scalarmult_base}, {}}; + +static u3j_harm _137_hex_coed__ed_add_scalarmult_scalarmult_base_a[] = + {{".2", u3wee_add_scalarmult_scalarmult_base}, {}}; + +static u3j_harm _137_hex_coed__ed_add_double_scalarmult_a[] = + {{".2", u3wee_add_double_scalarmult}, {}}; + +static u3j_core _137_hex_coed__ed_d[] = + { { "sign", 7, _137_hex_coed__ed_sign_a, 0, no_hashes }, + { "sign-raw", 7, _137_hex_coed__ed_sign_raw_a, 0, no_hashes }, + { "sign-octs", 7, _137_hex_coed__ed_sign_octs_a, 0, no_hashes }, + { "sign-octs-raw", 7, _137_hex_coed__ed_sign_octs_raw_a, 0, no_hashes }, + { "puck", 7, _137_hex_coed__ed_puck_a, 0, no_hashes }, + { "luck", 7, _137_hex_coed__ed_luck_a, 0, no_hashes }, + { "scad", 7, _137_hex_coed__ed_scad_a, 0, no_hashes }, + { "scas", 7, _137_hex_coed__ed_scas_a, 0, no_hashes }, + { "scap", 7, _137_hex_coed__ed_scap_a, 0, no_hashes }, + { "veri-octs", 7, _137_hex_coed__ed_veri_octs_a, 0, no_hashes }, + { "veri", 7, _137_hex_coed__ed_veri_a, 0, no_hashes }, + { "shar", 7, _137_hex_coed__ed_shar_a, 0, no_hashes }, + { "slar", 7, _137_hex_coed__ed_slar_a, 0, no_hashes }, + { "point-add", 7, _137_hex_coed__ed_point_add_a, 0, 0 }, + { "point-neg", 7, _137_hex_coed__ed_point_neg_a, 0, 0 }, + { "recs", 7, _137_hex_coed__ed_recs_a, 0, 0 }, + { "smac", 7, _137_hex_coed__ed_smac_a, 0, 0 }, + { "scalarmult", 7, _137_hex_coed__ed_scalarmult_a, 0, + no_hashes }, + { "scalarmult-base", 7, _137_hex_coed__ed_scalarmult_base_a, 0, + no_hashes }, + { "add-scalarmult-scalarmult-base", 7, + _137_hex_coed__ed_add_scalarmult_scalarmult_base_a, 0, + no_hashes }, + { "add-double-scalarmult", 7, + _137_hex_coed__ed_add_double_scalarmult_a, 0, + no_hashes }, + {} + }; + +static u3j_core _137_hex_coed_d[] = + { { "ed", 3, 0, _137_hex_coed__ed_d, no_hashes }, + {} + }; + +static u3j_harm _137_hex_hmac_hmac_a[] = {{".2", u3we_hmac}, {}}; +static u3j_core _137_hex_hmac_d[] = + { { "hmac", 7, _137_hex_hmac_hmac_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_argon2_a[] = {{".2", u3we_argon2}, {}}; +static u3j_core _137_hex_argon_d[] = + { { "argon2", 511, _137_hex_argon2_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_scr_pbk_a[] = {{".2", u3wes_pbk, c3y}, {}}; +static u3j_harm _137_hex_scr_pbl_a[] = {{".2", u3wes_pbl, c3y}, {}}; +static u3j_harm _137_hex_scr_hsh_a[] = {{".2", u3wes_hsh, c3y}, {}}; +static u3j_harm _137_hex_scr_hsl_a[] = {{".2", u3wes_hsl, c3y}, {}}; +static u3j_core _137_hex_scr_d[] = + { { "pbk", 7, _137_hex_scr_pbk_a, 0, no_hashes }, + { "pbl", 7, _137_hex_scr_pbl_a, 0, no_hashes }, + { "hsh", 7, _137_hex_scr_hsh_a, 0, no_hashes }, + { "hsl", 7, _137_hex_scr_hsl_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_secp_secp256k1_make_a[] = {{".2", u3we_make, c3y}, {}}; +static u3j_harm _137_hex_secp_secp256k1_sign_a[] = {{".2", u3we_sign, c3y}, {}}; +static u3j_harm _137_hex_secp_secp256k1_reco_a[] = {{".2", u3we_reco, c3y}, {}}; + +static u3j_harm _137_hex_secp_secp256k1_schnorr_sosi_a[] = + {{".2", u3we_sosi}, {}}; +static u3j_harm _137_hex_secp_secp256k1_schnorr_sove_a[] = + {{".2", u3we_sove}, {}}; +static u3j_core _137_hex_secp_secp256k1_schnorr_d[] = + { { "sosi", 7, + _137_hex_secp_secp256k1_schnorr_sosi_a, 0, + no_hashes }, + { "sove", 7, + _137_hex_secp_secp256k1_schnorr_sove_a, 0, + no_hashes }, + {} + }; + +static u3j_core _137_hex_secp_secp256k1_d[] = + { { "make", 7, _137_hex_secp_secp256k1_make_a, 0, no_hashes }, + { "sign", 7, _137_hex_secp_secp256k1_sign_a, 0, no_hashes }, + { "reco", 7, _137_hex_secp_secp256k1_reco_a, 0, no_hashes }, + { "schnorr", 7, 0, + _137_hex_secp_secp256k1_schnorr_d, + no_hashes }, + {} + }; +static u3j_core _137_hex_secp_d[] = + { { "secp256k1", 3, 0, _137_hex_secp_secp256k1_d, no_hashes }, + {} + }; + + +static u3j_harm _137_hex_kecc_k224_a[] = + {{".2", u3we_kecc224, c3y, c3y, c3y}, {}}; +static u3j_harm _137_hex_kecc_k256_a[] = + {{".2", u3we_kecc256, c3y, c3y, c3y}, {}}; +static u3j_harm _137_hex_kecc_k384_a[] = + {{".2", u3we_kecc384, c3y, c3y, c3y}, {}}; +static u3j_harm _137_hex_kecc_k512_a[] = + {{".2", u3we_kecc512, c3y, c3y, c3y}, {}}; +static u3j_core _137_hex_kecc_d[] = + { { "k224", 7, _137_hex_kecc_k224_a, 0, no_hashes }, + { "k256", 7, _137_hex_kecc_k256_a, 0, no_hashes }, + { "k384", 7, _137_hex_kecc_k384_a, 0, no_hashes }, + { "k512", 7, _137_hex_kecc_k512_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_ripemd_160_a[] = {{".2", u3we_ripe, c3y}, {}}; +static u3j_core _137_hex_ripe_d[] = + { { "ripemd160", 7, _137_hex_ripemd_160_a, 0, no_hashes }, + {} + }; + + + +/* layer five + */ +static u3j_harm _137_pen_cell_a[] = {{".2", u3wf_cell}, {}}; +static u3j_harm _137_pen_comb_a[] = {{".2", u3wf_comb}, {}}; +static u3j_harm _137_pen_cons_a[] = {{".2", u3wf_cons}, {}}; +static u3j_harm _137_pen_core_a[] = {{".2", u3wf_core}, {}}; +static u3j_harm _137_pen_face_a[] = {{".2", u3wf_face}, {}}; +static u3j_harm _137_pen_fitz_a[] = {{".2", u3wf_fitz}, {}}; +static u3j_harm _137_pen_fork_a[] = {{".2", u3wf_fork}, {}}; + +static u3j_harm _137_pen_look_a[] = {{".2", u3wf_look}, {}}; +static u3j_harm _137_pen_loot_a[] = {{".2", u3wf_loot}, {}}; + +static u3j_harm _137_pen__ut_crop_a[] = {{".2", u3wfu_crop}, {}}; +static u3j_harm _137_pen__ut_fish_a[] = {{".2", u3wfu_fish}, {}}; +static u3j_harm _137_pen__ut_fuse_a[] = {{".2", u3wfu_fuse}, {}}; +static u3j_harm _137_pen__ut_redo_a[] = {{".2", u3wfu_redo}, {}}; +static u3j_harm _137_pen__ut_mint_a[] = {{".2", u3wfu_mint}, {}}; +static u3j_harm _137_pen__ut_mull_a[] = {{".2", u3wfu_mull}, {}}; + +static u3j_harm _137_pen__ut_nest_dext_a[] = {{".2", u3wfu_nest_dext}, {}}; +static u3j_core _137_pen__ut_nest_in_d[] = + { + { "nest-dext", 3, _137_pen__ut_nest_dext_a, 0, no_hashes }, + {} + }; +static u3j_core _137_pen__ut_nest_d[] = + { + { "nest-in", 7, 0, _137_pen__ut_nest_in_d, no_hashes }, + {} + }; + +static u3j_harm _137_pen__ut_rest_a[] = {{".2", u3wfu_rest}, {}}; + +static u3j_core _137_pen__ut_d[] = + { + { "crop", 7, _137_pen__ut_crop_a, 0, no_hashes }, + { "fish", 7, _137_pen__ut_fish_a, 0, no_hashes }, + { "fuse", 7, _137_pen__ut_fuse_a, 0, no_hashes }, + { "redo", 7, _137_pen__ut_redo_a, 0, no_hashes }, + { "mint", 7, _137_pen__ut_mint_a, 0, no_hashes }, + { "mull", 7, _137_pen__ut_mull_a, 0, no_hashes }, + { "nest", 7, 0, _137_pen__ut_nest_d, no_hashes }, + { "rest", 7, _137_pen__ut_rest_a, 0, no_hashes }, + {} + }; + +static u3j_hood _137_pen__ut_ho[] = + { { "ar", 12282 }, + { "fan", 28, c3n }, + { "rib", 58, c3n }, + { "vet", 59, c3n }, + + { "blow", 6015 }, + { "burp", 342 }, + { "busk", 1373 }, + { "buss", 374 }, + { "crop", 1494 }, + { "duck", 1524 }, + { "dune", 2991 }, + { "dunk", 3066 }, + { "epla", 12206 }, + { "emin", 1534 }, + { "emul", 6134 }, + { "feel", 1502 }, + { "felt", 94 }, + { "fine", 49086 }, + { "fire", 4 }, + { "fish", 6006 }, + { "fond", 12283 }, + { "fund", 6014 }, + // XX +funk is not part of +ut, and this hook appears to be unused + // remove from here and the +ut hint + // + { "funk", 0xbefafa, c3y, 31 }, + { "fuse", 24021 }, + { "gain", 380 }, + { "lose", 0x2fefe }, + { "mile", 382 }, + { "mine", 372 }, + { "mint", 49083 }, + { "moot", 0x2feff }, + { "mull", 24020 }, + { "nest", 92 }, + { "peel", 1526 }, + { "play", 3006 }, + { "peek", 1532 }, + { "repo", 22 }, + { "rest", 6102 }, + { "tack", 6007 }, + { "toss", 24540 }, + { "wrap", 6137 }, + {}, + }; + + +static u3j_hood _137_pen_ho[] = { + { "ap", 22 }, + { "ut", 86 }, + {}, +}; + + +/* layer four + */ +static u3j_harm _137_qua_trip_a[] = {{".2", u3we_trip}, {}}; + +static u3j_harm _137_qua_slaw_a[] = {{".2", u3we_slaw}, {}}; +static u3j_harm _137_qua_scot_a[] = {{".2", u3we_scot}, {}}; +static u3j_harm _137_qua_scow_a[] = {{".2", u3we_scow}, {}}; + +static u3j_harm _137_qua__po_ind_a[] = {{".2", u3wcp_ind}, {}}; +static u3j_harm _137_qua__po_ins_a[] = {{".2", u3wcp_ins}, {}}; +static u3j_harm _137_qua__po_tod_a[] = {{".2", u3wcp_tod}, {}}; +static u3j_harm _137_qua__po_tos_a[] = {{".2", u3wcp_tos}, {}}; +static u3j_core _137_qua__po_d[] = + { { "ind", 7, _137_qua__po_ind_a, 0, no_hashes }, + { "ins", 7, _137_qua__po_ins_a, 0, no_hashes }, + { "tod", 7, _137_qua__po_tod_a, 0, no_hashes }, + { "tos", 7, _137_qua__po_tos_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__bend_fun_a[] = {{".2", u3we_bend_fun}, {}}; +static u3j_core _137_qua__bend_d[] = + { { "fun", 7, _137_qua__bend_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__cold_fun_a[] = {{".2", u3we_cold_fun}, {}}; +static u3j_core _137_qua__cold_d[] = + { { "fun", 7, _137_qua__cold_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__cook_fun_a[] = {{".2", u3we_cook_fun}, {}}; +static u3j_core _137_qua__cook_d[] = + { { "fun", 7, _137_qua__cook_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__comp_fun_a[] = {{".2", u3we_comp_fun}, {}}; +static u3j_core _137_qua__comp_d[] = + { { "fun", 7, _137_qua__comp_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__easy_fun_a[] = {{".2", u3we_easy_fun}, {}}; +static u3j_core _137_qua__easy_d[] = + { { "fun", 7, _137_qua__easy_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__glue_fun_a[] = {{".2", u3we_glue_fun}, {}}; +static u3j_core _137_qua__glue_d[] = + { { "fun", 7, _137_qua__glue_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__here_fun_a[] = {{".2", u3we_here_fun}, {}}; +static u3j_core _137_qua__here_d[] = + { { "fun", 7, _137_qua__here_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__just_fun_a[] = {{".2", u3we_just_fun}, {}}; +static u3j_core _137_qua__just_d[] = + { { "fun", 7, _137_qua__just_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__mask_fun_a[] = {{".2", u3we_mask_fun}, {}}; +static u3j_core _137_qua__mask_d[] = + { { "fun", 7, _137_qua__mask_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__shim_fun_a[] = {{".2", u3we_shim_fun}, {}}; +static u3j_core _137_qua__shim_d[] = + { { "fun", 7, _137_qua__shim_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__stag_fun_a[] = {{".2", u3we_stag_fun}, {}}; +static u3j_core _137_qua__stag_d[] = + { { "fun", 7, _137_qua__stag_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__stew_fun_a[] = {{".2", u3we_stew_fun}, {}}; +static u3j_core _137_qua__stew_d[] = + { { "fun", 31, _137_qua__stew_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua__stir_fun_a[] = {{".2", u3we_stir_fun}, {}}; +static u3j_core _137_qua__stir_d[] = + { { "fun", 7, _137_qua__stir_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_qua_pfix_a[] = {{".2", u3we_pfix}, {}}; + +static u3j_harm _137_qua_plug_a[] = {{".2", u3we_plug}, {}}; +static u3j_harm _137_qua_pose_a[] = {{".2", u3we_pose}, {}}; + +static u3j_harm _137_qua_sfix_a[] = {{".2", u3we_sfix}, {}}; + +static u3j_harm _137_qua_mink_a[] = {{".2", u3we_mink}, {}}; +static u3j_harm _137_qua_mole_a[] = {{".2", u3we_mole}, {}}; +static u3j_harm _137_qua_mule_a[] = {{".2", u3we_mule}, {}}; + + +static u3j_hood _137_qua_ho[] = { + { "mute", 0x2fbabe }, + { "show", 24406 }, + { "mure", 1374 }, + {}, +}; + + +/* layer three + */ +static u3j_harm _137_tri__cofl__drg_a[] = {{".2", u3wef_drg}, {}}; +static u3j_harm _137_tri__cofl__lug_a[] = {{".2", u3wef_lug}, {}}; +static u3j_core _137_tri__cofl_d[] = + { { "drg", 7, _137_tri__cofl__drg_a, 0, no_hashes }, + { "lug", 7, _137_tri__cofl__lug_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri__rd_add_a[] = {{".2", u3wer_add}, {}}; +static u3j_harm _137_tri__rd_sub_a[] = {{".2", u3wer_sub}, {}}; +static u3j_harm _137_tri__rd_mul_a[] = {{".2", u3wer_mul}, {}}; +static u3j_harm _137_tri__rd_div_a[] = {{".2", u3wer_div}, {}}; +static u3j_harm _137_tri__rd_sqt_a[] = {{".2", u3wer_sqt}, {}}; +static u3j_harm _137_tri__rd_fma_a[] = {{".2", u3wer_fma}, {}}; +static u3j_harm _137_tri__rd_lth_a[] = {{".2", u3wer_lth}, {}}; +static u3j_harm _137_tri__rd_lte_a[] = {{".2", u3wer_lte}, {}}; +static u3j_harm _137_tri__rd_equ_a[] = {{".2", u3wer_equ}, {}}; +static u3j_harm _137_tri__rd_gte_a[] = {{".2", u3wer_gte}, {}}; +static u3j_harm _137_tri__rd_gth_a[] = {{".2", u3wer_gth}, {}}; +static u3j_core _137_tri__rd_d[] = + { { "add", 7, _137_tri__rd_add_a, 0, no_hashes }, + { "sub", 7, _137_tri__rd_sub_a, 0, no_hashes }, + { "mul", 7, _137_tri__rd_mul_a, 0, no_hashes }, + { "div", 7, _137_tri__rd_div_a, 0, no_hashes }, + { "sqt", 7, _137_tri__rd_sqt_a, 0, no_hashes }, + { "fma", 7, _137_tri__rd_fma_a, 0, no_hashes }, + { "lth", 7, _137_tri__rd_lth_a, 0, no_hashes }, + { "lte", 7, _137_tri__rd_lte_a, 0, no_hashes }, + { "equ", 7, _137_tri__rd_equ_a, 0, no_hashes }, + { "gte", 7, _137_tri__rd_gte_a, 0, no_hashes }, + { "gth", 7, _137_tri__rd_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri__rs_add_a[] = {{".2", u3wet_add}, {}}; +static u3j_harm _137_tri__rs_sub_a[] = {{".2", u3wet_sub}, {}}; +static u3j_harm _137_tri__rs_mul_a[] = {{".2", u3wet_mul}, {}}; +static u3j_harm _137_tri__rs_div_a[] = {{".2", u3wet_div}, {}}; +static u3j_harm _137_tri__rs_sqt_a[] = {{".2", u3wet_sqt}, {}}; +static u3j_harm _137_tri__rs_fma_a[] = {{".2", u3wet_fma}, {}}; +static u3j_harm _137_tri__rs_lth_a[] = {{".2", u3wet_lth}, {}}; +static u3j_harm _137_tri__rs_lte_a[] = {{".2", u3wet_lte}, {}}; +static u3j_harm _137_tri__rs_equ_a[] = {{".2", u3wet_equ}, {}}; +static u3j_harm _137_tri__rs_gte_a[] = {{".2", u3wet_gte}, {}}; +static u3j_harm _137_tri__rs_gth_a[] = {{".2", u3wet_gth}, {}}; +static u3j_core _137_tri__rs_d[] = + { { "add", 7, _137_tri__rs_add_a, 0, no_hashes }, + { "sub", 7, _137_tri__rs_sub_a, 0, no_hashes }, + { "mul", 7, _137_tri__rs_mul_a, 0, no_hashes }, + { "div", 7, _137_tri__rs_div_a, 0, no_hashes }, + { "sqt", 7, _137_tri__rs_sqt_a, 0, no_hashes }, + { "fma", 7, _137_tri__rs_fma_a, 0, no_hashes }, + { "lth", 7, _137_tri__rs_lth_a, 0, no_hashes }, + { "lte", 7, _137_tri__rs_lte_a, 0, no_hashes }, + { "equ", 7, _137_tri__rs_equ_a, 0, no_hashes }, + { "gte", 7, _137_tri__rs_gte_a, 0, no_hashes }, + { "gth", 7, _137_tri__rs_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri__rq_add_a[] = {{".2", u3weq_add}, {}}; +static u3j_harm _137_tri__rq_sub_a[] = {{".2", u3weq_sub}, {}}; +static u3j_harm _137_tri__rq_mul_a[] = {{".2", u3weq_mul}, {}}; +static u3j_harm _137_tri__rq_div_a[] = {{".2", u3weq_div}, {}}; +static u3j_harm _137_tri__rq_sqt_a[] = {{".2", u3weq_sqt}, {}}; +static u3j_harm _137_tri__rq_fma_a[] = {{".2", u3weq_fma}, {}}; +static u3j_harm _137_tri__rq_lth_a[] = {{".2", u3weq_lth}, {}}; +static u3j_harm _137_tri__rq_lte_a[] = {{".2", u3weq_lte}, {}}; +static u3j_harm _137_tri__rq_equ_a[] = {{".2", u3weq_equ}, {}}; +static u3j_harm _137_tri__rq_gte_a[] = {{".2", u3weq_gte}, {}}; +static u3j_harm _137_tri__rq_gth_a[] = {{".2", u3weq_gth}, {}}; +static u3j_core _137_tri__rq_d[] = + { { "add", 7, _137_tri__rq_add_a, 0, no_hashes }, + { "sub", 7, _137_tri__rq_sub_a, 0, no_hashes }, + { "mul", 7, _137_tri__rq_mul_a, 0, no_hashes }, + { "div", 7, _137_tri__rq_div_a, 0, no_hashes }, + { "sqt", 7, _137_tri__rq_sqt_a, 0, no_hashes }, + { "fma", 7, _137_tri__rq_fma_a, 0, no_hashes }, + { "lth", 7, _137_tri__rq_lth_a, 0, no_hashes }, + { "lte", 7, _137_tri__rq_lte_a, 0, no_hashes }, + { "equ", 7, _137_tri__rq_equ_a, 0, no_hashes }, + { "gte", 7, _137_tri__rq_gte_a, 0, no_hashes }, + { "gth", 7, _137_tri__rq_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri__rh_add_a[] = {{".2", u3wes_add}, {}}; +static u3j_harm _137_tri__rh_sub_a[] = {{".2", u3wes_sub}, {}}; +static u3j_harm _137_tri__rh_mul_a[] = {{".2", u3wes_mul}, {}}; +static u3j_harm _137_tri__rh_div_a[] = {{".2", u3wes_div}, {}}; +static u3j_harm _137_tri__rh_sqt_a[] = {{".2", u3wes_sqt}, {}}; +static u3j_harm _137_tri__rh_fma_a[] = {{".2", u3wes_fma}, {}}; +static u3j_harm _137_tri__rh_lth_a[] = {{".2", u3wes_lth}, {}}; +static u3j_harm _137_tri__rh_lte_a[] = {{".2", u3wes_lte}, {}}; +static u3j_harm _137_tri__rh_equ_a[] = {{".2", u3wes_equ}, {}}; +static u3j_harm _137_tri__rh_gte_a[] = {{".2", u3wes_gte}, {}}; +static u3j_harm _137_tri__rh_gth_a[] = {{".2", u3wes_gth}, {}}; +static u3j_core _137_tri__rh_d[] = + { { "add", 7, _137_tri__rh_add_a, 0, no_hashes }, + { "sub", 7, _137_tri__rh_sub_a, 0, no_hashes }, + { "mul", 7, _137_tri__rh_mul_a, 0, no_hashes }, + { "div", 7, _137_tri__rh_div_a, 0, no_hashes }, + { "sqt", 7, _137_tri__rh_sqt_a, 0, no_hashes }, + { "fma", 7, _137_tri__rh_fma_a, 0, no_hashes }, + { "lth", 7, _137_tri__rh_lth_a, 0, no_hashes }, + { "lte", 7, _137_tri__rh_lte_a, 0, no_hashes }, + { "equ", 7, _137_tri__rh_equ_a, 0, no_hashes }, + { "gte", 7, _137_tri__rh_gte_a, 0, no_hashes }, + { "gth", 7, _137_tri__rh_gth_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri__og_raw_a[] = {{".2", u3weo_raw}, {}}; +static u3j_core _137_tri__og_d[] = + { { "raw", 7, _137_tri__og_raw_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri__sha_sha1_a[] = {{".2", u3we_sha1}, {}}; +static u3j_core _137_tri__sha_d[] = + { { "sha1", 7, _137_tri__sha_sha1_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_tri_shax_a[] = {{".2", u3we_shax}, {}}; +static u3j_harm _137_tri_shay_a[] = {{".2", u3we_shay}, {}}; +static u3j_harm _137_tri_shas_a[] = {{".2", u3we_shas}, {}}; +static u3j_harm _137_tri_shal_a[] = {{".2", u3we_shal}, {}}; + +static u3j_harm _137_ob_fynd_a[] = {{".2", u3we_fynd_ob}, {}}; +static u3j_harm _137_ob_fein_a[] = {{".2", u3we_fein_ob}, {}}; +static u3j_core _137_ob_d[] = { + { "fein", 7, _137_ob_fein_a, 0, no_hashes }, + { "fynd", 7, _137_ob_fynd_a, 0, no_hashes }, + {} +}; +static u3j_hood _137_ob_ho[] = { + { "fein", 42 }, + { "fynd", 20 }, + {}, +}; + + +static u3j_hood _137_tri_ho[] = { + { "ob", 20 }, + { "yore", 5462 }, + { "year", 44975 }, + {}, +}; + + +/* layer two + */ +static u3j_harm _137_two_find_a[] = {{".2", u3wb_find, c3y}, {}}; +static u3j_harm _137_two_flop_a[] = {{".2", u3wb_flop, c3y}, {}}; +static u3j_harm _137_two_lent_a[] = {{".2", u3wb_lent, c3y}, {}}; +static u3j_harm _137_two_levy_a[] = {{".2", u3wb_levy, c3y}, {}}; +static u3j_harm _137_two_lien_a[] = {{".2", u3wb_lien, c3y}, {}}; +static u3j_harm _137_two_murn_a[] = {{".2", u3wb_murn, c3y}, {}}; +static u3j_harm _137_two_need_a[] = {{".2", u3wb_need, c3y}, {}}; +static u3j_harm _137_two_reap_a[] = {{".2", u3wb_reap, c3y}, {}}; +static u3j_harm _137_two_reel_a[] = {{".2", u3wb_reel, c3y}, {}}; +static u3j_harm _137_two_roll_a[] = {{".2", u3wb_roll, c3y}, {}}; +static u3j_harm _137_two_skid_a[] = {{".2", u3wb_skid, c3y}, {}}; +static u3j_harm _137_two_skim_a[] = {{".2", u3wb_skim, c3y}, {}}; +static u3j_harm _137_two_skip_a[] = {{".2", u3wb_skip, c3y}, {}}; +static u3j_harm _137_two_scag_a[] = {{".2", u3wb_scag, c3y}, {}}; +static u3j_harm _137_two_slag_a[] = {{".2", u3wb_slag, c3y}, {}}; +static u3j_harm _137_two_snag_a[] = {{".2", u3wb_snag, c3y}, {}}; +static u3j_harm _137_two_sort_a[] = {{".2", u3wb_sort, c3y}, {}}; +static u3j_harm _137_two_turn_a[] = {{".2", u3wb_turn, c3y}, {}}; +static u3j_harm _137_two_weld_a[] = {{".2", u3wb_weld, c3y}, {}}; +static u3j_harm _137_two_welp_a[] = {{".2", u3wb_welp, c3y}, {}}; +static u3j_harm _137_two_zing_a[] = {{".2", u3wb_zing, c3y}, {}}; + +static u3j_harm _137_two_bex_a[] = {{".2", u3wc_bex, c3y}, {}}; +static u3j_harm _137_two_can_a[] = {{".2", u3wc_can, c3y}, {}}; +static u3j_harm _137_two_cat_a[] = {{".2", u3wc_cat, c3y}, {}}; +static u3j_harm _137_two_con_a[] = {{".2", u3wc_con, c3y}, {}}; +static u3j_harm _137_two_cut_a[] = {{".2", u3wc_cut, c3y}, {}}; +static u3j_harm _137_two_dis_a[] = {{".2", u3wc_dis, c3y}, {}}; +static u3j_harm _137_two_dor_a[] = {{".2", u3wc_dor, c3y}, {}}; +static u3j_harm _137_two_end_a[] = {{".2", u3wc_end, c3y}, {}}; +static u3j_harm _137_two_gor_a[] = {{".2", u3wc_gor, c3y}, {}}; +static u3j_harm _137_two_lsh_a[] = {{".2", u3wc_lsh, c3y}, {}}; +static u3j_harm _137_two_met_a[] = {{".2", u3wc_met, c3y}, {}}; +static u3j_harm _137_two_mix_a[] = {{".2", u3wc_mix, c3y}, {}}; +static u3j_harm _137_two_mor_a[] = {{".2", u3wc_mor, c3y}, {}}; +static u3j_harm _137_two_mug_a[] = {{".2", u3wc_mug, c3y}, {}}; +static u3j_harm _137_two_muk_a[] = {{".2", u3wc_muk, c3y}, {}}; +static u3j_harm _137_two_pow_a[] = {{".2", u3wc_pow, c3y}, {}}; +static u3j_harm _137_two_rap_a[] = {{".2", u3wc_rap, c3y}, {}}; +static u3j_harm _137_two_rep_a[] = {{".2", u3wc_rep, c3y}, {}}; +static u3j_harm _137_two_rev_a[] = {{".2", u3wc_rev, c3y}, {}}; +static u3j_harm _137_two_rip_a[] = {{".2", u3wc_rip, c3y}, {}}; +static u3j_harm _137_two_rsh_a[] = {{".2", u3wc_rsh, c3y}, {}}; +static u3j_harm _137_two_swp_a[] = {{".2", u3wc_swp, c3y}, {}}; +static u3j_harm _137_two_sqt_a[] = {{".2", u3wc_sqt, c3y}, {}}; +static u3j_harm _137_two_xeb_a[] = {{".2", u3wc_xeb, c3y}, {}}; + +static u3j_harm _137_two__in_bif_a[] = {{".2", u3wdi_bif}, {}}; +static u3j_harm _137_two__in_del_a[] = {{".2", u3wdi_del}, {}}; +static u3j_harm _137_two__in_dif_a[] = {{".2", u3wdi_dif}, {}}; +static u3j_harm _137_two__in_gas_a[] = {{".2", u3wdi_gas}, {}}; +static u3j_harm _137_two__in_has_a[] = {{".2", u3wdi_has}, {}}; +static u3j_harm _137_two__in_int_a[] = {{".2", u3wdi_int}, {}}; +static u3j_harm _137_two__in_put_a[] = {{".2", u3wdi_put}, {}}; +static u3j_harm _137_two__in_rep_a[] = {{".2", u3wdi_rep}, {}}; +static u3j_harm _137_two__in_run_a[] = {{".2", u3wdi_run}, {}}; +static u3j_harm _137_two__in_tap_a[] = {{".2", u3wdi_tap}, {}}; +static u3j_harm _137_two__in_wyt_a[] = {{".2", u3wdi_wyt}, {}}; +static u3j_harm _137_two__in_uni_a[] = {{".2", u3wdi_uni}, {}}; + +static u3j_harm _137_two__by_all_a[] = {{".2", u3wdb_all, c3y}, {}}; +static u3j_harm _137_two__by_any_a[] = {{".2", u3wdb_any, c3y}, {}}; +static u3j_harm _137_two__by_apt_a[] = {{".2", u3wdb_apt, c3y}, {}}; + +static u3j_harm _137_two__by_del_a[] = {{".2", u3wdb_del, c3y}, {}}; +static u3j_harm _137_two__by_dif_a[] = {{".2", u3wdb_dif, c3y}, {}}; +static u3j_harm _137_two__by_gas_a[] = {{".2", u3wdb_gas, c3y}, {}}; +static u3j_harm _137_two__by_get_a[] = {{".2", u3wdb_get, c3y}, {}}; +static u3j_harm _137_two__by_has_a[] = {{".2", u3wdb_has, c3y}, {}}; +static u3j_harm _137_two__by_int_a[] = {{".2", u3wdb_int, c3y}, {}}; +static u3j_harm _137_two__by_jab_a[] = {{".2", u3wdb_jab, c3y}, {}}; +static u3j_harm _137_two__by_key_a[] = {{".2", u3wdb_key, c3y}, {}}; +static u3j_harm _137_two__by_put_a[] = {{".2", u3wdb_put, c3y}, {}}; +static u3j_harm _137_two__by_rep_a[] = {{".2", u3wdb_rep, c3y}, {}}; +static u3j_harm _137_two__by_run_a[] = {{".2", u3wdb_run, c3y}, {}}; +static u3j_harm _137_two__by_tap_a[] = {{".2", u3wdb_tap, c3y}, {}}; +static u3j_harm _137_two__by_uni_a[] = {{".2", u3wdb_uni, c3y}, {}}; +static u3j_harm _137_two__by_urn_a[] = {{".2", u3wdb_urn, c3y}, {}}; +static u3j_harm _137_two__by_wyt_a[] = {{".2", u3wdb_wyt, c3y}, {}}; + +static u3j_harm _137_two_cue_a[] = {{".2", u3we_cue}, {}}; +static u3j_harm _137_two_jam_a[] = {{".2", u3we_jam}, {}}; +static u3j_harm _137_two_mat_a[] = {{".2", u3we_mat}, {}}; +static u3j_harm _137_two_rub_a[] = {{".2", u3we_rub}, {}}; + + + +/* layer one + */ +static u3j_harm _137_one_add_a[] = {{".2", u3wa_add, c3y}, {}}; +static u3j_harm _137_one_dec_a[] = {{".2", u3wa_dec, c3y}, {}}; +static u3j_harm _137_one_div_a[] = {{".2", u3wa_div, c3y}, {}}; +static u3j_harm _137_one_dvr_a[] = {{".2", u3wc_dvr, c3y}, {}}; +static u3j_harm _137_one_gte_a[] = {{".2", u3wa_gte, c3y}, {}}; +static u3j_harm _137_one_gth_a[] = {{".2", u3wa_gth, c3y}, {}}; +static u3j_harm _137_one_lte_a[] = {{".2", u3wa_lte, c3y}, {}}; +static u3j_harm _137_one_lth_a[] = {{".2", u3wa_lth, c3y}, {}}; +static u3j_harm _137_one_max_a[] = {{".2", u3wa_max, c3y}, {}}; +static u3j_harm _137_one_min_a[] = {{".2", u3wa_min, c3y}, {}}; +static u3j_harm _137_one_mod_a[] = {{".2", u3wa_mod, c3y}, {}}; +static u3j_harm _137_one_mul_a[] = {{".2", u3wa_mul, c3y}, {}}; +static u3j_harm _137_one_sub_a[] = {{".2", u3wa_sub, c3y}, {}}; + +static u3j_harm _137_one_cap_a[] = {{".2", u3wc_cap, c3y}, {}}; +static u3j_harm _137_one_peg_a[] = {{".2", u3wc_peg, c3y}, {}}; +static u3j_harm _137_one_mas_a[] = {{".2", u3wc_mas, c3y}, {}}; + +static u3j_harm _137_lull_plot_fax_a[] = {{".2", u3wg_plot_fax, c3y}, {}}; +static u3j_harm _137_lull_plot_met_a[] = {{".2", u3wg_plot_met, c3y}, {}}; + +static u3j_core _137_lull_plot_d[] = + { { "fax", 7, _137_lull_plot_fax_a, 0, no_hashes }, + { "met", 7, _137_lull_plot_met_a, 0, no_hashes }, + {} + }; + +static u3j_core _137_lull_d[] = + { { "plot", 31, 0, _137_lull_plot_d, no_hashes }, + {} + }; + +static u3j_harm _137_hex_blake3_hash_a[] = {{".2", u3we_blake3_hash, c3y}, {}}; +static u3j_harm _137_hex_blake3_compress_a[] = {{".2", u3we_blake3_compress, c3y}, {}}; +static u3j_harm _137_hex_blake3_chunk_output_a[] = {{".2", u3we_blake3_chunk_output, c3y}, {}}; + +static u3j_core _137_hex_blake3_d[] = + { { "hash", 7, _137_hex_blake3_hash_a, 0, no_hashes }, + { "chunk-output", 7, _137_hex_blake3_chunk_output_a, 0, no_hashes }, + {} + }; + + +static u3j_core _137_hex_blake3_impl_d[] = + { { "compress", 7, _137_hex_blake3_compress_a, 0, no_hashes }, + { "blake3", 7, 0, _137_hex_blake3_d, no_hashes }, + {} + }; + +static u3j_harm _137_hex_blake2b_a[] = {{".2", u3we_blake2b, c3y}, {}}; + +static u3j_core _137_hex_blake_d[] = + { { "blake2b", 7, _137_hex_blake2b_a, 0, no_hashes }, + { "blake3-impl", 7, 0, _137_hex_blake3_impl_d, no_hashes }, + {} + }; + + +static u3j_harm _137_hex_chacha_crypt_a[] = {{".2", u3we_chacha_crypt, c3y}, {}}; +static u3j_harm _137_hex_chacha_xchacha_a[] = {{".2", u3we_chacha_xchacha, c3y}, {}}; +static u3j_core _137_hex_chacha_d[] = + { { "crypt", 7, _137_hex_chacha_crypt_a, 0, no_hashes }, + { "xchacha", 7, _137_hex_chacha_xchacha_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_hex_json_de_a[] = {{".2", u3we_json_de}, {}}; +static u3j_harm _137_hex_json_en_a[] = {{".2", u3we_json_en}, {}}; +static u3j_core _137_hex_json_d[] = + { { "de", 15, _137_hex_json_de_a, 0, no_hashes }, + { "en", 15, _137_hex_json_en_a, 0, no_hashes }, + {} + }; + +/* /lib jets in non core +*/ +static u3j_harm _137_non__lagoon_add_a[] = {{".2", u3wi_la_add}, {}}; +static u3j_harm _137_non__lagoon_sub_a[] = {{".2", u3wi_la_sub}, {}}; +static u3j_harm _137_non__lagoon_mul_a[] = {{".2", u3wi_la_mul}, {}}; +static u3j_harm _137_non__lagoon_div_a[] = {{".2", u3wi_la_div}, {}}; +static u3j_harm _137_non__lagoon_mod_a[] = {{".2", u3wi_la_mod}, {}}; +static u3j_harm _137_non__lagoon_adds_a[] = {{".2", u3wi_la_adds}, {}}; +static u3j_harm _137_non__lagoon_subs_a[] = {{".2", u3wi_la_subs}, {}}; +static u3j_harm _137_non__lagoon_muls_a[] = {{".2", u3wi_la_muls}, {}}; +static u3j_harm _137_non__lagoon_divs_a[] = {{".2", u3wi_la_divs}, {}}; +static u3j_harm _137_non__lagoon_mods_a[] = {{".2", u3wi_la_mods}, {}}; +static u3j_harm _137_non__lagoon_dot_a[] = {{".2", u3wi_la_dot}, {}}; +static u3j_harm _137_non__lagoon_trans_a[] ={{".2", u3wi_la_transpose}, {}}; +static u3j_harm _137_non__lagoon_cumsum_a[]={{".2", u3wi_la_cumsum}, {}}; +static u3j_harm _137_non__lagoon_argmin_a[]={{".2", u3wi_la_argmin}, {}}; +static u3j_harm _137_non__lagoon_argmax_a[]={{".2", u3wi_la_argmax}, {}}; +static u3j_harm _137_non__lagoon_ravel_a[]={{".2", u3wi_la_ravel}, {}}; +static u3j_harm _137_non__lagoon_min_a[] = {{".2", u3wi_la_min}, {}}; +static u3j_harm _137_non__lagoon_max_a[] = {{".2", u3wi_la_max}, {}}; +static u3j_harm _137_non__lagoon_linspace_a[]={{".2", u3wi_la_linspace}, {}}; +static u3j_harm _137_non__lagoon_range_a[]= {{".2", u3wi_la_range}, {}}; +static u3j_harm _137_non__lagoon_abs_a[] = {{".2", u3wi_la_abs}, {}}; +static u3j_harm _137_non__lagoon_gth_a[] = {{".2", u3wi_la_gth}, {}}; +static u3j_harm _137_non__lagoon_gte_a[] = {{".2", u3wi_la_gte}, {}}; +static u3j_harm _137_non__lagoon_lth_a[] = {{".2", u3wi_la_lth}, {}}; +static u3j_harm _137_non__lagoon_lte_a[] = {{".2", u3wi_la_lte}, {}}; +static u3j_harm _137_non__lagoon_diag_a[] = {{".2", u3wi_la_diag}, {}}; +static u3j_harm _137_non__lagoon_trace_a[]= {{".2", u3wi_la_trace}, {}}; +static u3j_harm _137_non__lagoon_mmul_a[] = {{".2", u3wi_la_mmul}, {}}; + +static u3j_core _137_non__la_core_d[] = + { { "add-rays", 7, _137_non__lagoon_add_a, 0, no_hashes }, + { "sub-rays", 7, _137_non__lagoon_sub_a, 0, no_hashes }, + { "mul-rays", 7, _137_non__lagoon_mul_a, 0, no_hashes }, + { "div-rays", 7, _137_non__lagoon_div_a, 0, no_hashes }, + { "mod-rays", 7, _137_non__lagoon_mod_a, 0, no_hashes }, + { "add-scal", 7, _137_non__lagoon_adds_a, 0, no_hashes }, + { "sub-scal", 7, _137_non__lagoon_subs_a, 0, no_hashes }, + { "mul-scal", 7, _137_non__lagoon_muls_a, 0, no_hashes }, + { "div-scal", 7, _137_non__lagoon_divs_a, 0, no_hashes }, + { "mod-scal", 7, _137_non__lagoon_mods_a, 0, no_hashes }, + { "dot", 7, _137_non__lagoon_dot_a, 0, no_hashes }, + { "transpose",7, _137_non__lagoon_trans_a, 0, no_hashes }, + { "cumsum", 7, _137_non__lagoon_cumsum_a, 0, no_hashes }, + { "argmin", 7, _137_non__lagoon_argmin_a, 0, no_hashes }, + { "argmax", 7, _137_non__lagoon_argmax_a, 0, no_hashes }, + { "ravel", 7, _137_non__lagoon_ravel_a, 0, no_hashes }, + { "min", 7, _137_non__lagoon_min_a, 0, no_hashes }, + { "max", 7, _137_non__lagoon_max_a, 0, no_hashes }, + { "linspace", 7, _137_non__lagoon_linspace_a, 0, no_hashes }, + { "range", 7, _137_non__lagoon_range_a, 0, no_hashes }, + { "abs", 7, _137_non__lagoon_abs_a, 0, no_hashes }, + { "gth", 7, _137_non__lagoon_gth_a, 0, no_hashes }, + { "gte", 7, _137_non__lagoon_gte_a, 0, no_hashes }, + { "lth", 7, _137_non__lagoon_lth_a, 0, no_hashes }, + { "lte", 7, _137_non__lagoon_lte_a, 0, no_hashes }, + { "diag", 7, _137_non__lagoon_diag_a, 0, no_hashes }, + { "trace", 7, _137_non__lagoon_trace_a,0, no_hashes }, + { "mmul", 7, _137_non__lagoon_mmul_a, 0, no_hashes }, + {} + }; + +static u3j_core _137_non_d[] = + { { "lagoon", 7, 0, _137_non__la_core_d, no_hashes }, + {} + }; + + +static u3j_harm _137_hex_lia_run_v1_a[] = {{".2", u3we_lia_run_v1, c3y}, {}}; + +static u3j_harm _137_hex_lia_run_once_inner_a[] = {{".2", u3we_lia_run_once, c3y}, {}}; + +static u3j_core _137_hex_lia_run_once_d[] = { + { "run-once-inner-v0", 15, _137_hex_lia_run_once_inner_a, 0, no_hashes }, + {} +}; + +static u3j_core _137_hex_lia_monad_d[] = { + { "run-v1", 7, _137_hex_lia_run_v1_a, 0, no_hashes }, + { "run-once-v0", 7, 0, _137_hex_lia_run_once_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_wasm_engine_d[] = { + { "monad-v0", 3, 0, _137_hex_lia_monad_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_wasm_op_def_d[] = { + { "wasm-engine-v0", 3, 0, _137_hex_wasm_engine_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_wasm_validator_d[] = { + { "wasm-op-def-v0", 3, 0, _137_hex_wasm_op_def_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_wasm_parser_d[] = { + { "validator-v0", 3, 0, _137_hex_wasm_validator_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_lia_sur_d[] = { + { "wasm-parser-v0", 3, 0, _137_hex_wasm_parser_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_wasm_engine_sur_d[] = { + { "monad-sur-v1", 3, 0, _137_hex_lia_sur_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_wasm_sur_d[] = { + { "engine-sur-v0", 3, 0, _137_hex_wasm_engine_sur_d, no_hashes }, + {} +}; + +static u3j_core _137_hex_d[] = + { { "non", 7, 0, _137_non_d, no_hashes }, + + { "lull", 3, 0, _137_lull_d, no_hashes }, + + { "lore", 63, _137_hex_lore_a, 0, no_hashes }, + + { "leer", 63, _137_hex_leer_a, 0, no_hashes }, + { "loss", 63, _137_hex_loss_a, 0, no_hashes }, + { "lune", 127, _137_hex_lune_a, 0, no_hashes }, + + { "crc", 31, 0, _137_hex__crc_d, no_hashes }, + + { "coed", 63, 0, _137_hex_coed_d, no_hashes }, + { "aes", 31, 0, _137_hex_aes_d, no_hashes }, + + { "hmac", 63, 0, _137_hex_hmac_d, no_hashes }, + { "argon", 31, 0, _137_hex_argon_d, no_hashes }, + { "blake", 31, 0, _137_hex_blake_d, no_hashes }, + { "chacha", 31, 0, _137_hex_chacha_d, no_hashes }, + { "kecc", 31, 0, _137_hex_kecc_d, no_hashes }, + { "ripemd", 31, 0, _137_hex_ripe_d, no_hashes }, + { "scr", 31, 0, _137_hex_scr_d, no_hashes }, + { "secp", 6, 0, _137_hex_secp_d, no_hashes }, + { "mimes", 31, 0, _137_hex_mimes_d, no_hashes }, + { "json", 31, 0, _137_hex_json_d, no_hashes }, + { "wasm-sur-v0", 3, 0, _137_hex_wasm_sur_d, no_hashes }, + {} + }; + +static u3j_core _137_pen_d[] = + { { "hex", 7, 0, _137_hex_d, no_hashes }, + + { "cell", 7, _137_pen_cell_a, 0, no_hashes }, + { "comb", 7, _137_pen_comb_a, 0, no_hashes }, + { "cons", 7, _137_pen_cons_a, 0, no_hashes }, + { "core", 7, _137_pen_core_a, 0, no_hashes }, + { "face", 7, _137_pen_face_a, 0, no_hashes }, + { "fitz", 7, _137_pen_fitz_a, 0, no_hashes }, + { "fork", 7, _137_pen_fork_a, 0, no_hashes }, + { "look", 7, _137_pen_look_a, 0, no_hashes }, + { "loot", 7, _137_pen_loot_a, 0, no_hashes }, + { "ut", 15, 0, _137_pen__ut_d, no_hashes, _137_pen__ut_ho }, + {} + }; + +static u3j_core _137_qua_d[] = + { { "pen", 3, 0, _137_pen_d, no_hashes, _137_pen_ho }, + + { "po", 7, 0, _137_qua__po_d, no_hashes }, + + { "trip", 7, _137_qua_trip_a, 0, no_hashes }, + + { "bend", 7, 0, _137_qua__bend_d, no_hashes }, + { "cold", 7, 0, _137_qua__cold_d, no_hashes }, + { "comp", 7, 0, _137_qua__comp_d, no_hashes }, + { "cook", 7, 0, _137_qua__cook_d, no_hashes }, + { "easy", 7, 0, _137_qua__easy_d, no_hashes }, + { "glue", 7, 0, _137_qua__glue_d, no_hashes }, + { "here", 7, 0, _137_qua__here_d, no_hashes }, + { "just", 7, 0, _137_qua__just_d, no_hashes }, + { "mask", 7, 0, _137_qua__mask_d, no_hashes }, + { "shim", 7, 0, _137_qua__shim_d, no_hashes }, + { "stag", 7, 0, _137_qua__stag_d, no_hashes }, + { "stew", 7, 0, _137_qua__stew_d, no_hashes }, + { "stir", 7, 0, _137_qua__stir_d, no_hashes }, + + { "pfix", 7, _137_qua_pfix_a, 0, no_hashes }, + { "plug", 7, _137_qua_plug_a, 0, no_hashes }, + { "pose", 7, _137_qua_pose_a, 0, no_hashes }, + { "sfix", 7, _137_qua_sfix_a, 0, no_hashes }, + + { "mink", 7, _137_qua_mink_a, 0, no_hashes }, + { "mole", 7, _137_qua_mole_a, 0, no_hashes }, + { "mule", 7, _137_qua_mule_a, 0, no_hashes }, + + { "scot", 7, _137_qua_scot_a, 0, no_hashes }, + { "scow", 7, _137_qua_scow_a, 0, no_hashes }, + { "slaw", 7, _137_qua_slaw_a, 0, no_hashes }, + {} + }; + +static u3j_core _137_tri_d[] = + { { "qua", 3, 0, _137_qua_d, no_hashes, _137_qua_ho }, + + { "cofl", 7, 0, _137_tri__cofl_d, no_hashes }, + { "rd", 7, 0, _137_tri__rd_d, no_hashes }, + { "rs", 7, 0, _137_tri__rs_d, no_hashes }, + { "rq", 7, 0, _137_tri__rq_d, no_hashes }, + { "rh", 7, 0, _137_tri__rh_d, no_hashes }, + { "og", 7, 0, _137_tri__og_d, no_hashes }, + + { "sha", 7, 0, _137_tri__sha_d, no_hashes }, + { "shax", 7, _137_tri_shax_a, 0, no_hashes }, + { "shay", 7, _137_tri_shay_a, 0, no_hashes }, + { "shas", 7, _137_tri_shas_a, 0, no_hashes }, + { "shal", 7, _137_tri_shal_a, 0, no_hashes }, + + { "ob", 3, 0, _137_ob_d, no_hashes, _137_ob_ho }, + {} + }; + +static u3j_harm _137_two_clz_a[] = {{".2", u3wc_clz, c3n}, {}}; +static u3j_harm _137_two_ctz_a[] = {{".2", u3wc_ctz, c3n}, {}}; +static u3j_harm _137_two_ham_a[] = {{".2", u3wc_ham, c3n}, {}}; + +static u3j_harm _137_two__hew_fun_a[] = {{".2", u3wc_hew, c3n}, {}}; +static u3j_core _137_two__hew_d[] = + { { "fun", 15, _137_two__hew_fun_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_two__by_bif_a[] = {{".2", u3wdb_bif, c3y}, {}}; + +static u3j_core _137_two__by_d[] = + { { "all", 7, _137_two__by_all_a, 0, no_hashes }, + { "any", 7, _137_two__by_any_a, 0, no_hashes }, + { "apt", 7, _137_two__by_apt_a, 0, no_hashes }, + { "bif", 7, _137_two__by_bif_a, 0, no_hashes }, + { "del", 7, _137_two__by_del_a, 0, no_hashes }, + { "dif", 7, _137_two__by_dif_a, 0, no_hashes }, + { "gas", 7, _137_two__by_gas_a, 0, no_hashes }, + { "get", 7, _137_two__by_get_a, 0, no_hashes }, + { "has", 7, _137_two__by_has_a, 0, no_hashes }, + { "int", 7, _137_two__by_int_a, 0, no_hashes }, + { "jab", 7, _137_two__by_jab_a, 0, no_hashes }, + { "key", 7, _137_two__by_key_a, 0, no_hashes }, + { "put", 7, _137_two__by_put_a, 0, no_hashes }, + { "rep", 7, _137_two__by_rep_a, 0, no_hashes }, + { "run", 7, _137_two__by_run_a, 0, no_hashes }, + { "tap", 7, _137_two__by_tap_a, 0, no_hashes }, + { "uni", 7, _137_two__by_uni_a, 0, no_hashes }, + { "urn", 7, _137_two__by_urn_a, 0, no_hashes }, + { "wyt", 3, _137_two__by_wyt_a, 0, no_hashes }, + {} + }; + + +static u3j_harm _137_two__in_apt_a[] = {{".2", u3wdi_apt}, {}}; + +static u3j_core _137_two__in_d[] = + { { "apt", 7, _137_two__in_apt_a, 0, no_hashes }, + { "bif", 7, _137_two__in_bif_a, 0, no_hashes }, + { "del", 7, _137_two__in_del_a, 0, no_hashes }, + { "dif", 7, _137_two__in_dif_a, 0, no_hashes }, + { "gas", 7, _137_two__in_gas_a, 0, no_hashes }, + { "has", 7, _137_two__in_has_a, 0, no_hashes }, + { "int", 7, _137_two__in_int_a, 0, no_hashes }, + { "put", 7, _137_two__in_put_a, 0, no_hashes }, + { "rep", 7, _137_two__in_rep_a, 0, no_hashes }, + { "run", 7, _137_two__in_run_a, 0, no_hashes }, + { "tap", 7, _137_two__in_tap_a, 0, no_hashes }, + { "uni", 7, _137_two__in_uni_a, 0, no_hashes }, + { "wyt", 3, _137_two__in_wyt_a, 0, no_hashes }, + {} + }; + +static u3j_harm _137_two_rig_a[] = {{".2", u3wc_rig, c3n}, {}}; + +static u3j_harm _137_two_mate_a[] = {{".2", u3wb_mate, c3y}, {}}; +static u3j_harm _137_two_sew_a[] = {{".2", u3wc_sew, c3y}, {}}; + +static u3j_core _137_two_d[] = + { { "tri", 3, 0, _137_tri_d, no_hashes, _137_tri_ho }, + + { "find", 7, _137_two_find_a, 0, no_hashes }, + { "flop", 7, _137_two_flop_a, 0, no_hashes }, + { "lent", 7, _137_two_lent_a, 0, no_hashes }, + { "levy", 7, _137_two_levy_a, 0, no_hashes }, + { "lien", 7, _137_two_lien_a, 0, no_hashes }, + { "murn", 7, _137_two_murn_a, 0, no_hashes }, + { "need", 7, _137_two_need_a, 0, no_hashes }, + { "mate", 7, _137_two_mate_a, 0, no_hashes }, + { "reap", 7, _137_two_reap_a, 0, no_hashes }, + { "reel", 7, _137_two_reel_a, 0, no_hashes }, + { "roll", 7, _137_two_roll_a, 0, no_hashes }, + { "skid", 7, _137_two_skid_a, 0, no_hashes }, + { "skim", 7, _137_two_skim_a, 0, no_hashes }, + { "skip", 7, _137_two_skip_a, 0, no_hashes }, + { "scag", 7, _137_two_scag_a, 0, no_hashes }, + { "slag", 7, _137_two_slag_a, 0, no_hashes }, + { "snag", 7, _137_two_snag_a, 0, no_hashes }, + { "sort", 7, _137_two_sort_a, 0, no_hashes }, + { "turn", 7, _137_two_turn_a, 0, no_hashes }, + { "weld", 7, _137_two_weld_a, 0, no_hashes }, + { "welp", 7, _137_two_welp_a, 0, no_hashes }, + { "zing", 7, _137_two_zing_a, 0, no_hashes }, + + { "bex", 7, _137_two_bex_a, 0, no_hashes }, + { "cat", 7, _137_two_cat_a, 0, no_hashes }, + { "can", 7, _137_two_can_a, 0, no_hashes }, + { "clz", 7, _137_two_clz_a, 0, no_hashes }, + { "con", 7, _137_two_con_a, 0, no_hashes }, + { "ctz", 7, _137_two_ctz_a, 0, no_hashes }, + { "cue", 7, _137_two_cue_a, 0, no_hashes }, + { "cut", 7, _137_two_cut_a, 0, no_hashes }, + { "dis", 7, _137_two_dis_a, 0, no_hashes }, + { "dor", 7, _137_two_dor_a, 0, no_hashes }, + { "end", 7, _137_two_end_a, 0, no_hashes }, + { "gor", 7, _137_two_gor_a, 0, no_hashes }, + { "ham", 7, _137_two_ham_a, 0, no_hashes }, + { "hew", 7, 0, _137_two__hew_d, no_hashes }, + { "jam", 7, _137_two_jam_a, 0, no_hashes }, + { "lsh", 7, _137_two_lsh_a, 0, no_hashes }, + { "mat", 7, _137_two_mat_a, 0, no_hashes }, + { "met", 7, _137_two_met_a, 0, no_hashes }, + { "mix", 7, _137_two_mix_a, 0, no_hashes }, + { "mor", 7, _137_two_mor_a, 0, no_hashes }, + { "mug", 7, _137_two_mug_a, 0, no_hashes }, + { "muk", 59, _137_two_muk_a, 0, no_hashes }, + { "rap", 7, _137_two_rap_a, 0, no_hashes }, + { "rep", 7, _137_two_rep_a, 0, no_hashes }, + { "rev", 7, _137_two_rev_a, 0, no_hashes }, + { "rig", 7, _137_two_rig_a, 0, no_hashes }, + { "rip", 7, _137_two_rip_a, 0, no_hashes }, + { "rsh", 7, _137_two_rsh_a, 0, no_hashes }, + { "swp", 7, _137_two_swp_a, 0, no_hashes }, + { "rub", 7, _137_two_rub_a, 0, no_hashes }, + { "pow", 7, _137_two_pow_a, 0, no_hashes }, + { "sew", 7, _137_two_sew_a, 0, no_hashes }, + { "sqt", 7, _137_two_sqt_a, 0, no_hashes }, + { "xeb", 7, _137_two_xeb_a, 0, no_hashes }, + + { "by", 7, 0, _137_two__by_d, no_hashes }, + { "in", 7, 0, _137_two__in_d, no_hashes }, + {} + }; + +static u3j_core _137_one_d[] = + { { "two", 3, 0, _137_two_d, no_hashes }, + + { "add", 7, _137_one_add_a, 0, no_hashes }, + { "dec", 7, _137_one_dec_a, 0, no_hashes }, + { "div", 7, _137_one_div_a, 0, no_hashes }, + { "dvr", 7, _137_one_dvr_a, 0, no_hashes }, + { "gte", 7, _137_one_gte_a, 0, no_hashes }, + { "gth", 7, _137_one_gth_a, 0, no_hashes }, + { "lte", 7, _137_one_lte_a, 0, no_hashes }, + { "lth", 7, _137_one_lth_a, 0, no_hashes }, + { "max", 7, _137_one_max_a, 0, no_hashes }, + { "min", 7, _137_one_min_a, 0, no_hashes }, + { "mod", 7, _137_one_mod_a, 0, no_hashes }, + { "mul", 7, _137_one_mul_a, 0, no_hashes }, + { "sub", 7, _137_one_sub_a, 0, no_hashes }, + + { "cap", 7, _137_one_cap_a, 0, no_hashes }, + { "mas", 7, _137_one_mas_a, 0, no_hashes }, + { "peg", 7, _137_one_peg_a, 0, no_hashes }, + {} + }; + +u3j_core _k137_d[] = + { { "one", 3, 0, _137_one_d, no_hashes }, + {} + }; + diff --git a/vere/pkg/noun/jets/a/add.c b/vere/pkg/noun/jets/a/add.c new file mode 100644 index 0000000..308d143 --- /dev/null +++ b/vere/pkg/noun/jets/a/add.c @@ -0,0 +1,61 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_add(u3_atom a, + u3_atom b) +{ + if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + c3_w c = a + b; + + return u3i_word(c); + } + else if ( 0 == a ) { + return u3k(b); + } + else if ( 0 == b ) { + return u3k(a); + } + else { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + u3r_mp(b_mp, b); + + mpz_add(a_mp, a_mp, b_mp); + mpz_clear(b_mp); + + return u3i_mp(a_mp); + } +} + +u3_noun +u3wa_add(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_add(a, b); + } +} + +u3_noun +u3ka_add(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_add(a, b); + + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/dec.c b/vere/pkg/noun/jets/a/dec.c new file mode 100644 index 0000000..02a8ba1 --- /dev/null +++ b/vere/pkg/noun/jets/a/dec.c @@ -0,0 +1,57 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_inc(u3_atom a) +{ + return u3i_vint(u3k(a)); +} + +u3_noun +u3qa_dec(u3_atom a) +{ + if ( 0 == a ) { + return u3m_error("decrement-underflow"); + } + else { + if ( _(u3a_is_cat(a)) ) { + return a - 1; + } + else { + mpz_t a_mp; + + u3r_mp(a_mp, a); + mpz_sub_ui(a_mp, a_mp, 1); + + return u3i_mp(a_mp); + } + } +} + +u3_noun +u3wa_dec(u3_noun cor) +{ + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_dec(a); + } +} + +u3_noun +u3ka_dec(u3_atom a) +{ + u3_noun b = u3qa_dec(a); + u3z(a); + return b; +} diff --git a/vere/pkg/noun/jets/a/div.c b/vere/pkg/noun/jets/a/div.c new file mode 100644 index 0000000..74b33dd --- /dev/null +++ b/vere/pkg/noun/jets/a/div.c @@ -0,0 +1,57 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_div(u3_atom a, + u3_atom b) +{ + if ( 0 == b ) { + return u3m_error("divide-by-zero"); + } + else { + if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + return a / b; + } + else { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + u3r_mp(b_mp, b); + + mpz_tdiv_q(a_mp, a_mp, b_mp); + mpz_clear(b_mp); + + return u3i_mp(a_mp); + } + } +} + +u3_noun +u3wa_div(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_div(a, b); + } +} + +u3_noun +u3ka_div(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_div(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/gte.c b/vere/pkg/noun/jets/a/gte.c new file mode 100644 index 0000000..371727d --- /dev/null +++ b/vere/pkg/noun/jets/a/gte.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_gte(u3_atom a, u3_atom b) +{ + if (c3y == u3a_is_cat(a) || c3y == u3a_is_cat(b)) + { + return __( a >= b ); + } + + if (a == b) return c3y; + + u3a_atom* a_u = u3a_to_ptr(a); + u3a_atom* b_u = u3a_to_ptr(b); + + if (a_u->len_w != b_u->len_w) + { + return __( a_u->len_w > b_u->len_w ); + } + + c3_w* a_w = a_u->buf_w; + c3_w* b_w = b_u->buf_w; + for (c3_w i_w = a_u->len_w; i_w--;) + { + if (a_w[i_w] > b_w[i_w]) return c3y; + if (a_w[i_w] < b_w[i_w]) return c3n; + } + + return c3y; +} + +u3_noun +u3wa_gte(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + || (c3n == u3ud(b)) + || (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_gte(a, b); + } +} diff --git a/vere/pkg/noun/jets/a/gth.c b/vere/pkg/noun/jets/a/gth.c new file mode 100644 index 0000000..3863b94 --- /dev/null +++ b/vere/pkg/noun/jets/a/gth.c @@ -0,0 +1,60 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_gth(u3_atom a, u3_atom b) +{ + if (c3y == u3a_is_cat(a) || c3y == u3a_is_cat(b)) + { + return __( a > b ); + } + + if (a == b) return c3n; + + u3a_atom* a_u = u3a_to_ptr(a); + u3a_atom* b_u = u3a_to_ptr(b); + + if (a_u->len_w != b_u->len_w) + { + return __( a_u->len_w > b_u->len_w ); + } + + c3_w* a_w = a_u->buf_w; + c3_w* b_w = b_u->buf_w; + for (c3_w i_w = a_u->len_w; i_w--;) + { + if (a_w[i_w] > b_w[i_w]) return c3y; + if (a_w[i_w] < b_w[i_w]) return c3n; + } + + return c3n; +} + +u3_noun +u3wa_gth(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + || (c3n == u3ud(b)) + || (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_gth(a, b); + } +} + +u3_noun +u3ka_gth(u3_noun a, u3_noun b) +{ + u3_noun c = u3qa_gth(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/lte.c b/vere/pkg/noun/jets/a/lte.c new file mode 100644 index 0000000..0565212 --- /dev/null +++ b/vere/pkg/noun/jets/a/lte.c @@ -0,0 +1,60 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_lte(u3_atom a, u3_atom b) +{ + if (c3y == u3a_is_cat(a) || c3y == u3a_is_cat(b)) + { + return __( a <= b ); + } + + if (a == b) return c3y; + + u3a_atom* a_u = u3a_to_ptr(a); + u3a_atom* b_u = u3a_to_ptr(b); + + if (a_u->len_w != b_u->len_w) + { + return __( a_u->len_w < b_u->len_w ); + } + + c3_w* a_w = a_u->buf_w; + c3_w* b_w = b_u->buf_w; + for (c3_w i_w = a_u->len_w; i_w--;) + { + if (a_w[i_w] < b_w[i_w]) return c3y; + if (a_w[i_w] > b_w[i_w]) return c3n; + } + + return c3y; +} + +u3_noun +u3wa_lte(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + || (c3n == u3ud(b)) + || (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_lte(a, b); + } +} + +u3_noun +u3ka_lte(u3_noun a, u3_noun b) +{ + u3_noun c = u3qa_lte(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/lth.c b/vere/pkg/noun/jets/a/lth.c new file mode 100644 index 0000000..edf95b3 --- /dev/null +++ b/vere/pkg/noun/jets/a/lth.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_lth(u3_atom a, u3_atom b) +{ + if (c3y == u3a_is_cat(a) || c3y == u3a_is_cat(b)) + { + return __( a < b ); + } + + if (a == b) return c3n; + + u3a_atom* a_u = u3a_to_ptr(a); + u3a_atom* b_u = u3a_to_ptr(b); + + if (a_u->len_w != b_u->len_w) + { + return __( a_u->len_w < b_u->len_w ); + } + + c3_w* a_w = a_u->buf_w; + c3_w* b_w = b_u->buf_w; + for (c3_w i_w = a_u->len_w; i_w--;) + { + if (a_w[i_w] < b_w[i_w]) return c3y; + if (a_w[i_w] > b_w[i_w]) return c3n; + } + + return c3n; +} + +u3_noun +u3wa_lth(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + || (c3n == u3ud(b)) + || (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_lth(a, b); + } +} diff --git a/vere/pkg/noun/jets/a/max.c b/vere/pkg/noun/jets/a/max.c new file mode 100644 index 0000000..2646ec7 --- /dev/null +++ b/vere/pkg/noun/jets/a/max.c @@ -0,0 +1,60 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_max(u3_atom a, u3_atom b) +{ + if ( _(u3a_is_cat(a)) || _(u3a_is_cat(b)) ) + { + return u3k(c3_max(a, b)); + } + + if (a == b) return u3k(a); + + u3a_atom* a_u = u3a_to_ptr(a); + u3a_atom* b_u = u3a_to_ptr(b); + + if (a_u->len_w != b_u->len_w) + { + return (a_u->len_w > b_u->len_w) ? u3k(a) : u3k(b); + } + + c3_w* a_w = a_u->buf_w; + c3_w* b_w = b_u->buf_w; + for (c3_w i_w = a_u->len_w; i_w--;) + { + if (a_w[i_w] > b_w[i_w]) return u3k(a); + if (a_w[i_w] < b_w[i_w]) return u3k(b); + } + + return u3k(a); +} + +u3_noun +u3wa_max(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + || (c3n == u3ud(b)) + || (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_max(a, b); + } +} + +u3_noun +u3ka_max(u3_noun a, u3_noun b) +{ + u3_noun c = u3qa_max(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/min.c b/vere/pkg/noun/jets/a/min.c new file mode 100644 index 0000000..00a75e6 --- /dev/null +++ b/vere/pkg/noun/jets/a/min.c @@ -0,0 +1,62 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_min(u3_atom a, u3_atom b) +{ + if ( _(u3a_is_cat(a)) || _(u3a_is_cat(b)) ) + { + // this will always return a direct atom, no refcount gain necessary + // + return c3_min(a, b); + } + + if (a == b) return u3k(a); + + u3a_atom* a_u = u3a_to_ptr(a); + u3a_atom* b_u = u3a_to_ptr(b); + + if (a_u->len_w != b_u->len_w) + { + return (a_u->len_w < b_u->len_w) ? u3k(a) : u3k(b); + } + + c3_w* a_w = a_u->buf_w; + c3_w* b_w = b_u->buf_w; + for (c3_w i_w = a_u->len_w; i_w--;) + { + if (a_w[i_w] < b_w[i_w]) return u3k(a); + if (a_w[i_w] > b_w[i_w]) return u3k(b); + } + + return u3k(a); +} + +u3_noun +u3wa_min(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + || (c3n == u3ud(b)) + || (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_min(a, b); + } +} + +u3_noun +u3ka_min(u3_noun a, u3_noun b) +{ + u3_noun c = u3qa_min(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/mod.c b/vere/pkg/noun/jets/a/mod.c new file mode 100644 index 0000000..1eb9aab --- /dev/null +++ b/vere/pkg/noun/jets/a/mod.c @@ -0,0 +1,55 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_mod(u3_atom a, + u3_atom b) +{ + if ( 0 == b ) { + return u3m_error("divide-by-zero"); + } + else if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + return a % b; + } + else { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + u3r_mp(b_mp, b); + + mpz_tdiv_r(a_mp, a_mp, b_mp); + mpz_clear(b_mp); + + return u3i_mp(a_mp); + } +} + +u3_noun +u3wa_mod(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_mod(a, b); + } +} + +u3_noun +u3ka_mod(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_mod(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/mul.c b/vere/pkg/noun/jets/a/mul.c new file mode 100644 index 0000000..aaba68c --- /dev/null +++ b/vere/pkg/noun/jets/a/mul.c @@ -0,0 +1,58 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_mul(u3_atom a, + u3_atom b) +{ + if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + c3_d c = ((c3_d) a) * ((c3_d) b); + + return u3i_chubs(1, &c); + } + else if ( 0 == a ) { + return 0; + } + else { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + u3r_mp(b_mp, b); + + mpz_mul(a_mp, a_mp, b_mp); + mpz_clear(b_mp); + + return u3i_mp(a_mp); + } +} + +u3_noun +u3wa_mul(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_mul(a, b); + } +} + +u3_noun +u3ka_mul(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_mul(a, b); + + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/a/sub.c b/vere/pkg/noun/jets/a/sub.c new file mode 100644 index 0000000..321ba77 --- /dev/null +++ b/vere/pkg/noun/jets/a/sub.c @@ -0,0 +1,67 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qa_sub(u3_atom a, + u3_atom b) +{ + if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + if ( a < b ) { + return u3m_error("subtract-underflow"); + } + else { + return (a - b); + } + } + else if ( 0 == b ) { + return u3k(a); + } + else { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + u3r_mp(b_mp, b); + + if ( mpz_cmp(a_mp, b_mp) < 0 ) { + mpz_clear(a_mp); + mpz_clear(b_mp); + + return u3m_error("subtract-underflow"); + } + mpz_sub(a_mp, a_mp, b_mp); + mpz_clear(b_mp); + + return u3i_mp(a_mp); + } +} + +u3_noun +u3wa_sub(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(b)) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } + else { + return u3qa_sub(a, b); + } +} + +u3_noun +u3ka_sub(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_sub(a, b); + + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/b/bind.c b/vere/pkg/noun/jets/b/bind.c new file mode 100644 index 0000000..7f37a69 --- /dev/null +++ b/vere/pkg/noun/jets/b/bind.c @@ -0,0 +1,30 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_bind(u3_noun a, + u3_noun b) + { + if ( 0 == a ) { + return 0; + } else { + return u3nc(0, u3n_slam_on(u3k(b), u3k(u3t(a)))); + } + } + u3_noun + u3wb_bind(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_bind(a, b); + } + } + diff --git a/vere/pkg/noun/jets/b/clap.c b/vere/pkg/noun/jets/b/clap.c new file mode 100644 index 0000000..9cfb41a --- /dev/null +++ b/vere/pkg/noun/jets/b/clap.c @@ -0,0 +1,36 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_clap(u3_noun a, + u3_noun b, + u3_noun c) + { + if ( 0 == a ) { + return u3k(b); + } + else if ( 0 == b ) { + return u3k(a); + } + else { + return u3nc(0, u3n_slam_on(u3k(c), u3nc(u3k(u3t(a)), u3k(u3t(b))))); + } + } + u3_noun + u3wb_clap(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_6, &b, + u3x_sam_7, &c, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_clap(a, b, c); + } + } diff --git a/vere/pkg/noun/jets/b/find.c b/vere/pkg/noun/jets/b/find.c new file mode 100644 index 0000000..c0295d2 --- /dev/null +++ b/vere/pkg/noun/jets/b/find.c @@ -0,0 +1,50 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +STATIC_ASSERT( (UINT32_MAX > u3a_cells), + "list index precision" ); + +u3_noun +u3qb_find(u3_noun nedl, u3_noun hstk) +{ + if ( u3_nul != nedl ) { + c3_w i_w = 0; + + while ( u3_nul != hstk ) { + u3_noun i_h, t_h = hstk; + u3_noun i_n, t_n = nedl; + u3x_cell(t_h, &i_h, &t_h); + u3x_cell(t_n, &i_n, &t_n); + + while ( c3y == u3r_sing(i_n, i_h) ) { + if ( u3_nul == t_n ) { + return u3nc(u3_nul, u3i_word(i_w)); + } + else if ( u3_nul == t_h ) { + break; + } + else { + u3x_cell(t_h, &i_h, &t_h); + u3x_cell(t_n, &i_n, &t_n); + } + } + + hstk = u3t(hstk); + i_w++; + } + } + + return u3_nul; +} + +u3_noun +u3wb_find(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_find(a, b); +} diff --git a/vere/pkg/noun/jets/b/flop.c b/vere/pkg/noun/jets/b/flop.c new file mode 100644 index 0000000..0574e4e --- /dev/null +++ b/vere/pkg/noun/jets/b/flop.c @@ -0,0 +1,34 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_flop(u3_noun a) +{ + u3_noun i, t = a, b = u3_nul; + + while ( u3_nul != t ) { + u3x_cell(t, &i, &t); + b = u3nc(u3k(i), b); + } + + return b; +} + +u3_noun +u3wb_flop(u3_noun cor) +{ + return u3qb_flop(u3x_at(u3x_sam, cor)); +} + +u3_noun +u3kb_flop(u3_noun a) +{ + u3_noun b = u3qb_flop(a); + u3z(a); + return b; +} diff --git a/vere/pkg/noun/jets/b/lent.c b/vere/pkg/noun/jets/b/lent.c new file mode 100644 index 0000000..aa3a701 --- /dev/null +++ b/vere/pkg/noun/jets/b/lent.c @@ -0,0 +1,37 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +STATIC_ASSERT( (UINT32_MAX > u3a_cells), + "length precision" ); + +u3_noun +u3qb_lent(u3_noun a) +{ + c3_w len_w = 0; + + while ( u3_nul != a ) { + a = u3t(a); + len_w++; + } + + return u3i_word(len_w); +} + +u3_noun +u3wb_lent(u3_noun cor) +{ + return u3qb_lent(u3x_at(u3x_sam, cor)); +} + +u3_noun +u3kb_lent(u3_noun a) +{ + u3_noun b = u3qb_lent(a); + u3z(a); + return b; +} diff --git a/vere/pkg/noun/jets/b/levy.c b/vere/pkg/noun/jets/b/levy.c new file mode 100644 index 0000000..39d6f39 --- /dev/null +++ b/vere/pkg/noun/jets/b/levy.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3qb_levy(u3_noun a, + u3_noun b) + { + u3_noun pro = c3y; + c3_o loz_o; + + if ( u3_nul != a ) { + u3j_site sit_u; + u3_noun i, t; + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + loz_o = u3x_loob(u3j_gate_slam(&sit_u, u3k(i))); + if ( c3n == loz_o ) { + pro = c3n; + break; + } + + t = u3k(u3t(a)); + u3z(a), a = t; + } while ( u3_nul != a ); + + u3z(a); + u3j_gate_lose(&sit_u); + } + + return pro; + } + + u3_noun + u3wb_levy(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_levy(a, b); + } + } diff --git a/vere/pkg/noun/jets/b/lien.c b/vere/pkg/noun/jets/b/lien.c new file mode 100644 index 0000000..2a9290a --- /dev/null +++ b/vere/pkg/noun/jets/b/lien.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3qb_lien(u3_noun a, + u3_noun b) + { + u3_noun pro = c3n; + c3_o loz_o; + + if ( u3_nul != a ) { + u3j_site sit_u; + u3_noun i, t; + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + loz_o = u3x_loob(u3j_gate_slam(&sit_u, u3k(i))); + if ( c3y == loz_o ) { + pro = c3y; + break; + } + + t = u3k(u3t(a)); + u3z(a), a = t; + } while ( u3_nul != a ); + + u3z(a); + u3j_gate_lose(&sit_u); + } + + return pro; + } + + u3_noun + u3wb_lien(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_lien(a, b); + } + } diff --git a/vere/pkg/noun/jets/b/mate.c b/vere/pkg/noun/jets/b/mate.c new file mode 100644 index 0000000..f8dbd31 --- /dev/null +++ b/vere/pkg/noun/jets/b/mate.c @@ -0,0 +1,30 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_mate(u3_noun a, + u3_noun b) + { + if ( u3_nul == b ) { + return u3k(a); + } else if ( u3_nul == a ) { + return u3k(b); + } else if ( c3y == u3r_sing(u3t(a), u3t(b)) ) { + return u3k(a); + } else { + return u3m_error("mate"); + } + } + u3_noun + u3wb_mate(u3_noun cor) + { + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_mate(a, b); + } + diff --git a/vere/pkg/noun/jets/b/murn.c b/vere/pkg/noun/jets/b/murn.c new file mode 100644 index 0000000..dcb592b --- /dev/null +++ b/vere/pkg/noun/jets/b/murn.c @@ -0,0 +1,54 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_murn(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3_noun* lit = &pro; + + if ( u3_nul != a ) { + u3_noun* hed; + u3_noun* tel; + u3_noun res, i, t; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + res = u3j_gate_slam(&sit_u, u3k(i)); + + if ( u3_nul != res ) { + *lit = u3i_defcons(&hed, &tel); + *hed = u3k(u3t(res)); + lit = tel; + u3z(res); + } + + t = u3k(u3t(a)); + u3z(a), a = t; + } + while ( u3_nul != a ); + + u3j_gate_lose(&sit_u); + } + + *lit = u3_nul; + + return pro; +} + +u3_noun +u3wb_murn(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_murn(a, b); +} diff --git a/vere/pkg/noun/jets/b/need.c b/vere/pkg/noun/jets/b/need.c new file mode 100644 index 0000000..8723699 --- /dev/null +++ b/vere/pkg/noun/jets/b/need.c @@ -0,0 +1,30 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_need(u3_noun a) + { + if ( 0 == a ) { + return u3m_bail(c3__exit); + } + else { + return u3k(u3t(a)); + } + } + u3_noun + u3wb_need(u3_noun cor) + { + u3_noun a; + + if ( u3_none == (a = u3r_at(u3x_sam, cor)) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_need(a); + } + } + diff --git a/vere/pkg/noun/jets/b/reap.c b/vere/pkg/noun/jets/b/reap.c new file mode 100644 index 0000000..35dd055 --- /dev/null +++ b/vere/pkg/noun/jets/b/reap.c @@ -0,0 +1,41 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_reap(u3_atom a, + u3_noun b) + { + if ( !_(u3a_is_cat(a)) ) { + return u3m_bail(c3__fail); + } + else { + u3_noun acc = u3_nul; + c3_w i_w = a; + + while ( i_w ) { + acc = u3nc(u3k(b), acc); + i_w--; + } + + return acc; + } + } + + u3_noun + u3wb_reap(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qb_reap(a, b); + } + } diff --git a/vere/pkg/noun/jets/b/reel.c b/vere/pkg/noun/jets/b/reel.c new file mode 100644 index 0000000..fe84f5a --- /dev/null +++ b/vere/pkg/noun/jets/b/reel.c @@ -0,0 +1,52 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3qb_reel(u3_noun a, + u3_noun b) + { + u3_noun pro = u3k(u3x_at(u3x_sam_3, b)); + + if ( u3_nul != a ) { + u3a_pile pil_u; + u3j_site sit_u; + u3_noun* top; + u3_noun i, t = a; + + u3a_pile_prep(&pil_u, sizeof(u3_noun)); + + // push list onto road stack + // + do { + u3x_cell(t, &i, &t); + top = u3a_push(&pil_u); + *top = u3k(i); + } while ( u3_nul != t ); + + u3j_gate_prep(&sit_u, u3k(b)); + + while ( c3n == u3a_pile_done(&pil_u) ) { + pro = u3j_gate_slam(&sit_u, u3nc(*top, pro)); + top = u3a_pop(&pil_u); + } + + u3j_gate_lose(&sit_u); + } + + return pro; + } + u3_noun + u3wb_reel(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_reel(a, b); + } + } diff --git a/vere/pkg/noun/jets/b/roll.c b/vere/pkg/noun/jets/b/roll.c new file mode 100644 index 0000000..66a4726 --- /dev/null +++ b/vere/pkg/noun/jets/b/roll.c @@ -0,0 +1,44 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3qb_roll(u3_noun a, + u3_noun b) + { + u3_noun pro = u3k(u3x_at(u3x_sam_3, b)); + + if ( u3_nul != a ) { + u3j_site sit_u; + u3_noun i, t; + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + pro = u3j_gate_slam(&sit_u, u3nc(u3k(i), pro)); + + t = u3k(u3t(a)); + u3z(a), a = t; + } while ( u3_nul != a ); + u3j_gate_lose(&sit_u); + } + + return pro; + } + u3_noun + u3wb_roll(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_roll(a, b); + } + } + diff --git a/vere/pkg/noun/jets/b/scag.c b/vere/pkg/noun/jets/b/scag.c new file mode 100644 index 0000000..d13dd46 --- /dev/null +++ b/vere/pkg/noun/jets/b/scag.c @@ -0,0 +1,53 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_scag(u3_atom a, u3_noun b) +{ + if ( u3_nul == b ) { + return u3_nul; + } + else if ( !_(u3a_is_cat(a)) ) { + return u3m_bail(c3__fail); + } + else { + u3_noun pro; + u3_noun* lit = &pro; + + { + c3_w len_w = (c3_w)a; + u3_noun* hed; + u3_noun* tel; + u3_noun i, t = b; + + while ( len_w-- && (u3_nul != t) ) { + u3x_cell(t, &i, &t); + + *lit = u3i_defcons(&hed, &tel); + *hed = u3k(i); + lit = tel; + } + } + + *lit = u3_nul; + + return pro; + } +} + +u3_noun +u3wb_scag(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + + if ( (c3n == u3ud(a)) && (u3_nul != b) ) { + return u3m_bail(c3__exit); + } + + return u3qb_scag(a, b); +} diff --git a/vere/pkg/noun/jets/b/skid.c b/vere/pkg/noun/jets/b/skid.c new file mode 100644 index 0000000..8d0d7ef --- /dev/null +++ b/vere/pkg/noun/jets/b/skid.c @@ -0,0 +1,62 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_skid(u3_noun a, u3_noun b) +{ + u3_noun l, r; + u3_noun* lef = &l; + u3_noun* rig = &r; + + if ( u3_nul != a) { + u3_noun i, t; + u3_noun* hed; + u3_noun* tel; + u3j_site sit_u; + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + switch ( u3j_gate_slam(&sit_u, u3k(i)) ) { + case c3y: { + *lef = u3i_defcons(&hed, &tel); + *hed = u3k(i); + lef = tel; + } break; + + case c3n: { + *rig = u3i_defcons(&hed, &tel); + *hed = u3k(i); + rig = tel; + } break; + + default: u3m_bail(c3__exit); + } + + t = u3k(u3t(a)); + u3z(a), a = t; + } + while ( u3_nul != a ); + + u3j_gate_lose(&sit_u); + } + + *lef = u3_nul; + *rig = u3_nul; + + return u3nc(l, r); +} + +u3_noun +u3wb_skid(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_skid(a, b); +} diff --git a/vere/pkg/noun/jets/b/skim.c b/vere/pkg/noun/jets/b/skim.c new file mode 100644 index 0000000..b0f2255 --- /dev/null +++ b/vere/pkg/noun/jets/b/skim.c @@ -0,0 +1,56 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_skim(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3_noun* lit = &pro; + + if ( u3_nul != a) { + u3_noun i, t; + u3_noun* hed; + u3_noun* tel; + u3j_site sit_u; + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + switch ( u3j_gate_slam(&sit_u, u3k(i)) ) { + case c3y: { + *lit = u3i_defcons(&hed, &tel); + *hed = u3k(i); + lit = tel; + } break; + + case c3n: break; + + default: u3m_bail(c3__exit); + } + + t = u3k(u3t(a)); + u3z(a), a = t; + } + while ( u3_nul != a ); + + u3j_gate_lose(&sit_u); + } + + *lit = u3_nul; + + return pro; +} + +u3_noun +u3wb_skim(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_skim(a, b); +} diff --git a/vere/pkg/noun/jets/b/skip.c b/vere/pkg/noun/jets/b/skip.c new file mode 100644 index 0000000..67f537d --- /dev/null +++ b/vere/pkg/noun/jets/b/skip.c @@ -0,0 +1,56 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_skip(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3_noun* lit = &pro; + + if ( u3_nul != a) { + u3_noun i, t; + u3_noun* hed; + u3_noun* tel; + u3j_site sit_u; + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + switch ( u3j_gate_slam(&sit_u, u3k(i)) ) { + case c3y: break; + + case c3n: { + *lit = u3i_defcons(&hed, &tel); + *hed = u3k(i); + lit = tel; + } break; + + default: u3m_bail(c3__exit); + } + + t = u3k(u3t(a)); + u3z(a), a = t; + } + while ( u3_nul != a ); + + u3j_gate_lose(&sit_u); + } + + *lit = u3_nul; + + return pro; +} + +u3_noun +u3wb_skip(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_skip(a, b); +} diff --git a/vere/pkg/noun/jets/b/slag.c b/vere/pkg/noun/jets/b/slag.c new file mode 100644 index 0000000..fad88b0 --- /dev/null +++ b/vere/pkg/noun/jets/b/slag.c @@ -0,0 +1,43 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_slag(u3_atom a, u3_noun b) + { + if ( u3_nul == b ) { + return u3_nul; + } + else if ( !_(u3a_is_cat(a)) ) { + return u3m_bail(c3__fail); + } + else { + c3_w len_w = a; + + while ( len_w ) { + if ( c3n == u3du(b) ) { + return u3_nul; + } + b = u3t(b); + len_w--; + } + return u3k(b); + } + } + u3_noun + u3wb_slag(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a) && u3_nul != b) ) + { + return u3m_bail(c3__exit); + } else { + return u3qb_slag(a, b); + } + } diff --git a/vere/pkg/noun/jets/b/snag.c b/vere/pkg/noun/jets/b/snag.c new file mode 100644 index 0000000..4b6dad8 --- /dev/null +++ b/vere/pkg/noun/jets/b/snag.c @@ -0,0 +1,44 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qb_snag(u3_atom a, + u3_noun b) + { + if ( !_(u3a_is_cat(a)) ) { + return u3m_bail(c3__fail); + } + else { + c3_w len_w = a; + + while ( len_w ) { + if ( c3n == u3du(b) ) { + return u3m_bail(c3__exit); + } + b = u3t(b); + len_w--; + } + if ( c3n == u3du(b) ) { + return u3m_bail(c3__exit); + } + return u3k(u3h(b)); + } + } + u3_noun + u3wb_snag(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qb_snag(a, b); + } + } diff --git a/vere/pkg/noun/jets/b/sort.c b/vere/pkg/noun/jets/b/sort.c new file mode 100644 index 0000000..ea5507c --- /dev/null +++ b/vere/pkg/noun/jets/b/sort.c @@ -0,0 +1,125 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + +static_assert( (UINT32_MAX > u3a_cells), + "length precision" ); + +static_assert( + (UINT32_MAX < (SIZE_MAX / (2 * sizeof(u3_noun)))), + "len_w * sizeof u3_noun overflow" +); + +static void +_merge_sort(u3_noun* restrict arr_u, + u3_noun* restrict tmp_u, + c3_w lef_w, + c3_w rit_w, + u3j_site* sit_u) +{ + if ( lef_w >= rit_w ) return; + c3_w mid_w = (lef_w + rit_w) / 2; + if (mid_w < lef_w) + { + // addition wrapped around + // + u3m_bail(c3__fail); + } + _merge_sort(arr_u, tmp_u, lef_w, mid_w, sit_u); + _merge_sort(arr_u, tmp_u, mid_w + 1, rit_w, sit_u); + + c3_w i_w = lef_w, j_w = mid_w + 1, k_w = lef_w; + while (i_w <= mid_w && j_w <= rit_w) + { + // reversed comparison to mimick order reversal of pivot + // and compared element in Hoon + // + u3_noun sam = u3nc(u3k(arr_u[j_w]), u3k(arr_u[i_w])); + c3_o hoz_o = u3x_loob(u3j_gate_slam(sit_u, sam)); + if ( c3n == hoz_o ) + tmp_u[k_w++] = arr_u[i_w++]; + else + tmp_u[k_w++] = arr_u[j_w++]; + } + + while (i_w <= mid_w) tmp_u[k_w++] = arr_u[i_w++]; + while (j_w <= rit_w) tmp_u[k_w++] = arr_u[j_w++]; + + for (i_w = lef_w; i_w <= rit_w; i_w++) + { + arr_u[i_w] = tmp_u[i_w]; + } +} + +// RETAINS list, transfers product +// +static u3_noun +_sort(u3j_site* sit_u, u3_noun list) +{ + if (u3_nul == list) return u3_nul; + + c3_w len_w = 1; + { + u3_noun t = u3t(list); + while (u3_nul != t) + { + ++len_w; t = u3t(t); + } + } + + if (1 == len_w) return u3k(list); + u3_noun* arr_u = u3a_malloc(sizeof(u3_noun) * len_w * 2); + u3_noun* tmp_u = arr_u + len_w; + for (c3_w i_w = 0; i_w < len_w; i_w++) + { + // inlined u3r_cell without any checks + // since the list was already validated and measured + // + u3a_cell* cel_u = u3a_to_ptr(list); + arr_u[i_w] = u3k(cel_u->hed); + list = cel_u->tel; + } + + _merge_sort(arr_u, tmp_u, 0, len_w - 1, sit_u); + + u3_noun pro = u3_nul; + for (c3_w i_w = len_w; i_w--;) + { + pro = u3nc(arr_u[i_w], pro); + } + + u3a_free(arr_u); + + return pro; +} + +u3_noun +u3qb_sort(u3_noun a, + u3_noun b) +{ + u3_noun pro; + u3j_site sit_u; + u3j_gate_prep(&sit_u, u3k(b)); + pro = _sort(&sit_u, a); + u3j_gate_lose(&sit_u); + return pro; +} + +u3_noun +u3wb_sort(u3_noun cor) +{ + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) + { + return u3m_bail(c3__exit); + } + else + { + return u3qb_sort(a, b); + } +} diff --git a/vere/pkg/noun/jets/b/turn.c b/vere/pkg/noun/jets/b/turn.c new file mode 100644 index 0000000..e5ee5f7 --- /dev/null +++ b/vere/pkg/noun/jets/b/turn.c @@ -0,0 +1,49 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_turn(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3_noun* lit = &pro; + + if ( u3_nul != a ) { + u3_noun* hed; + u3_noun* tel; + u3_noun i, t; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + u3k(a); + + do { + i = u3h(a); + + *lit = u3i_defcons(&hed, &tel); + *hed = u3j_gate_slam(&sit_u, u3k(i)); + lit = tel; + + t = u3k(u3t(a)); + u3z(a), a = t; + } + while ( u3_nul != a ); + + u3j_gate_lose(&sit_u); + } + + *lit = u3_nul; + + return pro; +} + +u3_noun +u3wb_turn(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_turn(a, b); +} diff --git a/vere/pkg/noun/jets/b/weld.c b/vere/pkg/noun/jets/b/weld.c new file mode 100644 index 0000000..d50fa1c --- /dev/null +++ b/vere/pkg/noun/jets/b/weld.c @@ -0,0 +1,48 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_weld(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3_noun* lit = &pro; + + { + u3_noun* hed; + u3_noun* tel; + u3_noun i, t = a; + + while ( u3_nul != t ) { + u3x_cell(t, &i, &t); + + *lit = u3i_defcons(&hed, &tel); + *hed = u3k(i); + lit = tel; + } + } + + *lit = u3k(b); + + return pro; +} + +u3_noun +u3wb_weld(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qb_weld(a, b); +} + +u3_noun +u3kb_weld(u3_noun a, u3_noun b) +{ + u3_noun c = u3qb_weld(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/b/zing.c b/vere/pkg/noun/jets/b/zing.c new file mode 100644 index 0000000..1172d5e --- /dev/null +++ b/vere/pkg/noun/jets/b/zing.c @@ -0,0 +1,47 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qb_zing(u3_noun a) +{ + u3_noun pro; + u3_noun* lit = &pro; + + if ( u3_nul == a ) { + *lit = u3_nul; + } + else { + u3_noun i, t = a; + u3x_cell(t, &i, &t); + + while ( u3_nul != t ) { + u3_noun* hed; + u3_noun* tel; + u3_noun i_i, t_i = i; + + while ( u3_nul != t_i ) { + u3x_cell(t_i, &i_i, &t_i); + + *lit = u3i_defcons(&hed, &tel); + *hed = u3k(i_i); + lit = tel; + } + + u3x_cell(t, &i, &t); + } + + *lit = u3k(i); + } + + return pro; +} + +u3_noun +u3wb_zing(u3_noun cor) +{ + return u3qb_zing(u3x_at(u3x_sam, cor)); +} diff --git a/vere/pkg/noun/jets/c/aor.c b/vere/pkg/noun/jets/c/aor.c new file mode 100644 index 0000000..248661e --- /dev/null +++ b/vere/pkg/noun/jets/c/aor.c @@ -0,0 +1,69 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3qc_aor(u3_noun a, + u3_noun b) + { + while ( 1 ) { + if ( c3y == u3r_sing(a, b) ) return c3y; + if ( c3n == u3ud(a) ) { + if ( c3y == u3ud(b) ) return c3n; + if ( c3y == u3r_sing(u3h(a), u3h(b)) ) { + a = u3t(a); + b = u3t(b); + } + else { + a = u3h(a); + b = u3h(b); + } + } + else { + if ( c3n == u3ud(b) ) return c3y; + { + c3_w len_a_w = u3r_met(3, a); + c3_w len_b_w = u3r_met(3, b);; + c3_y *buf_a_y, *buf_b_y; + c3_y cut_a_y, cut_b_y; + if ( c3y == u3a_is_cat(a) ) { + buf_a_y = (c3_y*)&a; + } + else { + u3a_atom* a_u = u3a_to_ptr(a); + buf_a_y = (c3_y*)(a_u->buf_w); + } + if ( c3y == u3a_is_cat(b) ) { + buf_b_y = (c3_y*)&b; + } + else { + u3a_atom* b_u = u3a_to_ptr(b); + buf_b_y = (c3_y*)(b_u->buf_w); + } + c3_w len_min_w = c3_min(len_a_w, len_b_w); + for (c3_w i_w = 0; i_w < len_min_w; i_w++) { + cut_a_y = buf_a_y[i_w]; + cut_b_y = buf_b_y[i_w]; + if ( cut_a_y != cut_b_y ) return __(cut_a_y < cut_b_y); + } + return __(len_a_w < len_b_w); + } + } + } + } + + u3_noun + u3wc_aor(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qc_aor(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/bex.c b/vere/pkg/noun/jets/c/bex.c new file mode 100644 index 0000000..497ebfd --- /dev/null +++ b/vere/pkg/noun/jets/c/bex.c @@ -0,0 +1,55 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_bex(u3_atom a) +{ + c3_d a_d; + u3i_slab sab_u; + + if ( a < 31 ) { + return 1U << a; + } + + if ( c3y == u3a_is_cat(a) ) { + a_d = a; + } + else { + if ( c3n == u3r_safe_chub(a, &a_d) ) { + return u3m_bail(c3__fail); + } + + // We don't currently support atoms 2GB or larger (fails while + // mugging). The extra term of 16 is experimentally determined. + if ( a_d >= ((c3_d)1 << (c3_d)34) - 16 ) { + u3l_log("bex: overflow"); + return u3m_bail(c3__fail); + } + } + + u3i_slab_init(&sab_u, 0, a_d + 1); + + sab_u.buf_w[a_d >> 5] = 1U << (a_d & 31); + + return u3i_slab_moot(&sab_u); +} + +u3_noun +u3kc_bex(u3_atom a) +{ + u3_noun b = u3qc_bex(a); + u3z(a); + return b; +} + +u3_noun +u3wc_bex(u3_noun cor) +{ + u3_noun a = u3x_at(u3x_sam, cor); + return u3qc_bex(u3x_atom(a)); +} diff --git a/vere/pkg/noun/jets/c/c0n.c b/vere/pkg/noun/jets/c/c0n.c new file mode 100644 index 0000000..a6fee5b --- /dev/null +++ b/vere/pkg/noun/jets/c/c0n.c @@ -0,0 +1,55 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_con(u3_atom a, + u3_atom b) + { + c3_w lna_w = u3r_met(5, a); + c3_w lnb_w = u3r_met(5, b); + + if ( (lna_w == 0) && (lnb_w == 0) ) { + return 0; + } + else { + c3_w len_w = c3_max(lna_w, lnb_w); + c3_w i_w; + u3i_slab sab_u; + u3i_slab_from(&sab_u, a, 5, len_w); + + for ( i_w = 0; i_w < lnb_w; i_w++ ) { + sab_u.buf_w[i_w] |= u3r_word(i_w, b); + } + + return u3i_slab_mint(&sab_u); + } + } + u3_noun + u3wc_con(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_con(a, b); + } + } + +u3_noun +u3kc_con(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qc_con(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/c/can.c b/vere/pkg/noun/jets/c/can.c new file mode 100644 index 0000000..ca6d97a --- /dev/null +++ b/vere/pkg/noun/jets/c/can.c @@ -0,0 +1,85 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_can(u3_atom a, + u3_noun b) + { + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else { + c3_g a_g = a; + c3_w tot_w = 0; + u3i_slab sab_u; + + /* Measure and validate the slab required. + */ + { + u3_noun cab = b; + + while ( 1 ) { + u3_noun i_cab, pi_cab, qi_cab; + + if ( 0 == cab ) { + break; + } + if ( c3n == u3du(cab) ) return u3m_bail(c3__fail); + i_cab = u3h(cab); + if ( c3n == u3du(i_cab) ) return u3m_bail(c3__fail); + pi_cab = u3h(i_cab); + qi_cab = u3t(i_cab); + if ( c3n == u3a_is_cat(pi_cab) ) return u3m_bail(c3__fail); + if ( c3n == u3ud(qi_cab) ) return u3m_bail(c3__fail); + if ( (tot_w + pi_cab) < tot_w ) return u3m_bail(c3__fail); + + tot_w += pi_cab; + cab = u3t(cab); + } + + if ( 0 == tot_w ) { + return 0; + } + + u3i_slab_init(&sab_u, a_g, tot_w); + } + + /* Chop the list atoms in. + */ + { + u3_noun cab = b; + c3_w pos_w = 0; + + while ( 0 != cab ) { + u3_noun i_cab = u3h(cab); + u3_atom pi_cab = u3h(i_cab); + u3_atom qi_cab = u3t(i_cab); + + u3r_chop(a_g, 0, pi_cab, pos_w, sab_u.buf_w, qi_cab); + pos_w += pi_cab; + cab = u3t(cab); + } + } + + return u3i_slab_mint(&sab_u); + } + } + u3_noun + u3wc_can(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qc_can(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/cap.c b/vere/pkg/noun/jets/c/cap.c new file mode 100644 index 0000000..95bef1f --- /dev/null +++ b/vere/pkg/noun/jets/c/cap.c @@ -0,0 +1,25 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_cap(u3_atom a) +{ + c3_w met_w = u3r_met(0, a); + + if ( 2 > met_w ) { + return u3m_bail(c3__exit); + } + else { + return 2 + u3r_bit((met_w - 2), a); + } +} + +u3_noun +u3wc_cap(u3_noun cor) +{ + return u3qc_cap(u3x_atom(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/c/cat.c b/vere/pkg/noun/jets/c/cat.c new file mode 100644 index 0000000..f3c4d2d --- /dev/null +++ b/vere/pkg/noun/jets/c/cat.c @@ -0,0 +1,54 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_cat(u3_atom a, + u3_atom b, + u3_atom c) + { + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else { + c3_g a_g = a; + c3_w lew_w = u3r_met(a_g, b); + c3_w ler_w = u3r_met(a_g, c); + c3_w all_w = (lew_w + ler_w); + + if ( 0 == all_w ) { + return 0; + } + else { + u3i_slab sab_u; + u3i_slab_from(&sab_u, b, a_g, all_w); + + u3r_chop(a_g, 0, ler_w, lew_w, sab_u.buf_w, c); + + return u3i_slab_mint(&sab_u); + } + } + } + + u3_noun + u3wc_cat(u3_noun cor) + { + u3_noun a, b, c; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_6, &b, + u3x_sam_7, &c, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_cat(a, b, c); + } + } + diff --git a/vere/pkg/noun/jets/c/clz.c b/vere/pkg/noun/jets/c/clz.c new file mode 100644 index 0000000..f8da45a --- /dev/null +++ b/vere/pkg/noun/jets/c/clz.c @@ -0,0 +1,75 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_atom +u3qc_clz(u3_atom boq, u3_atom sep, u3_atom a) +{ + if ( !_(u3a_is_cat(boq)) || (boq >= 32) ) { + return u3m_bail(c3__fail); + } + + if ( !_(u3a_is_cat(sep)) ) { + return u3m_bail(c3__fail); + } + + c3_g boq_g = boq; + c3_w sep_w = sep; + c3_w tot_w = sep_w << boq_g; + + if ( (tot_w >> boq_g) != sep_w ) { + return u3m_bail(c3__fail); + } + + c3_w met_w = u3r_met(0, a); + + if ( met_w <= tot_w ) { + tot_w -= met_w; + return u3i_word(tot_w); + } + else { + c3_w wid_w = tot_w >> 5; + c3_w bit_w = tot_w & 31; + c3_w wor_w; + + if ( bit_w ) { + wor_w = u3r_word(wid_w, a); + wor_w &= (1 << bit_w) - 1; + + if ( wor_w ) { + return bit_w - (32 - c3_lz_w(wor_w)); + } + } + + while ( wid_w-- ) { + wor_w = u3r_word(wid_w, a); + + if ( wor_w ) { + bit_w += c3_lz_w(wor_w); + break; + } + + bit_w += 32; + } + + return u3i_word(bit_w); + } +} + +u3_noun +u3wc_clz(u3_noun cor) +{ + u3_atom boq, sep, vat; + { + u3_noun sam = u3h(u3t(cor)); + u3_noun bit = u3h(sam); + + u3x_bite(bit, &boq, &sep); + vat = u3x_atom(u3t(sam)); + } + + return u3qc_clz(boq, sep, vat); +} diff --git a/vere/pkg/noun/jets/c/ctz.c b/vere/pkg/noun/jets/c/ctz.c new file mode 100644 index 0000000..ff74e24 --- /dev/null +++ b/vere/pkg/noun/jets/c/ctz.c @@ -0,0 +1,34 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_atom +u3qc_ctz(u3_atom a) +{ + c3_w wor_w, i_w = 0; + + if ( 0 == a ) { + return 0; + } + + do { + wor_w = u3r_word(i_w++, a); + } + while ( !wor_w ); + + { + c3_w bit_d = i_w - 1; + bit_d *= 32; + bit_d += c3_tz_w(wor_w); + return u3i_chub(bit_d); + } +} + +u3_noun +u3wc_ctz(u3_noun cor) +{ + return u3qc_ctz(u3x_atom(u3h(u3t(cor)))); +} diff --git a/vere/pkg/noun/jets/c/cut.c b/vere/pkg/noun/jets/c/cut.c new file mode 100644 index 0000000..43ed8c4 --- /dev/null +++ b/vere/pkg/noun/jets/c/cut.c @@ -0,0 +1,68 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_cut(u3_atom a, + u3_atom b, + u3_atom c, + u3_atom d) + { + c3_w b_w, c_w; + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + if ( !_(u3r_safe_word(b, &b_w)) ) { + return u3m_bail(c3__fail); + } + if ( !_(u3r_safe_word(c, &c_w)) ) { + return u3m_bail(c3__fail); + } + + { + c3_g a_g = a; + c3_w len_w = u3r_met(a_g, d); + + if ( (0 == c_w) || (b_w >= len_w) ) { + return 0; + } + if ( b_w + c_w > len_w ) { + c_w = (len_w - b_w); + } + if ( (b_w == 0) && (c_w == len_w) ) { + return u3k(d); + } + else { + u3i_slab sab_u; + u3i_slab_init(&sab_u, a_g, c_w); + + u3r_chop(a_g, b_w, c_w, 0, sab_u.buf_w, d); + + return u3i_slab_mint(&sab_u); + } + } + } + u3_noun + u3wc_cut(u3_noun cor) + { + u3_noun a, b, c, d; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_12, &b, + u3x_sam_13, &c, + u3x_sam_7, &d, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) || + (c3n == u3ud(d)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_cut(a, b, c, d); + } + } + diff --git a/vere/pkg/noun/jets/c/dis.c b/vere/pkg/noun/jets/c/dis.c new file mode 100644 index 0000000..8c41a36 --- /dev/null +++ b/vere/pkg/noun/jets/c/dis.c @@ -0,0 +1,46 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_dis(u3_atom a, + u3_atom b) + { + c3_w lna_w = u3r_met(5, a); + c3_w lnb_w = u3r_met(5, b); + + if ( (lna_w == 0) && (lnb_w == 0) ) { + return 0; + } + else { + c3_w len_w = c3_max(lna_w, lnb_w); + c3_w i_w; + u3i_slab sab_u; + u3i_slab_from(&sab_u, a, 5, len_w); + + for ( i_w = 0; i_w < len_w; i_w++ ) { + sab_u.buf_w[i_w] &= u3r_word(i_w, b); + } + + return u3i_slab_mint(&sab_u); + } + } + u3_noun + u3wc_dis(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_dis(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/dor.c b/vere/pkg/noun/jets/c/dor.c new file mode 100644 index 0000000..0c1e220 --- /dev/null +++ b/vere/pkg/noun/jets/c/dor.c @@ -0,0 +1,49 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_dor(u3_noun a, + u3_noun b) + { + if ( c3y == u3r_sing(a, b) ) { + return c3y; + } + else { + if ( c3y == u3ud(a) ) { + if ( c3y == u3ud(b) ) { + return u3qa_lth(a, b); + } + else { + return c3y; + } + } + else { + if ( c3y == u3ud(b) ) { + return c3n; + } + else { + if ( c3y == u3r_sing(u3h(a), u3h(b)) ) { + return u3qc_dor(u3t(a), u3t(b)); + } + else return u3qc_dor(u3h(a), u3h(b)); + } + } + } + } + u3_noun + u3wc_dor(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qc_dor(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/dvr.c b/vere/pkg/noun/jets/c/dvr.c new file mode 100644 index 0000000..d822bf3 --- /dev/null +++ b/vere/pkg/noun/jets/c/dvr.c @@ -0,0 +1,46 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_dvr(u3_atom a, + u3_atom b) + { + if ( 0 == b ) { + return u3m_error("divide-by-zero"); + } + else { + if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + return u3nc(a / b, a % b); + } + else { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + u3r_mp(b_mp, b); + + mpz_tdiv_qr(a_mp, b_mp, a_mp, b_mp); + + return u3nc(u3i_mp(a_mp), u3i_mp(b_mp)); + } + } + } + u3_noun + u3wc_dvr(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qc_dvr(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/end.c b/vere/pkg/noun/jets/c/end.c new file mode 100644 index 0000000..94618ad --- /dev/null +++ b/vere/pkg/noun/jets/c/end.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_end(u3_atom a, + u3_atom b, + u3_atom c) +{ + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else if ( !_(u3a_is_cat(b)) ) { + return u3k(c); + } + else { + c3_g a_g = a; + c3_w b_w = b; + c3_w len_w = u3r_met(a_g, c); + + if ( 0 == b_w ) { + return 0; + } + else if ( b_w >= len_w ) { + return u3k(c); + } + else { + u3i_slab sab_u; + u3i_slab_init(&sab_u, a_g, b_w); + + u3r_chop(a_g, 0, b_w, 0, sab_u.buf_w, c); + + return u3i_slab_mint(&sab_u); + } + } +} + +u3_noun +u3wc_end(u3_noun cor) +{ + u3_atom bloq, step; + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0); + u3x_bite(a, &bloq, &step); + + return u3qc_end(bloq, step, u3x_atom(b)); +} diff --git a/vere/pkg/noun/jets/c/gor.c b/vere/pkg/noun/jets/c/gor.c new file mode 100644 index 0000000..91c2d98 --- /dev/null +++ b/vere/pkg/noun/jets/c/gor.c @@ -0,0 +1,32 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_gor(u3_noun a, + u3_noun b) + { + c3_w c_w = u3r_mug(a); + c3_w d_w = u3r_mug(b); + + if ( c_w == d_w ) { + return u3qc_dor(a, b); + } + else return (c_w < d_w) ? c3y : c3n; + } + u3_noun + u3wc_gor(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { + return u3m_bail(c3__exit); + } else { + return u3qc_gor(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/ham.c b/vere/pkg/noun/jets/c/ham.c new file mode 100644 index 0000000..776cf0c --- /dev/null +++ b/vere/pkg/noun/jets/c/ham.c @@ -0,0 +1,27 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_atom +u3qc_ham(u3_atom a) +{ + c3_w len_w = u3r_met(5, a); + c3_d pop_d = 0; + c3_w wor_w; + + for ( c3_w i_w = 0; i_w < len_w; i_w++ ) { + wor_w = u3r_word(i_w, a); + pop_d += c3_pc_w(wor_w); + } + + return u3i_chub(pop_d); +} + +u3_noun +u3wc_ham(u3_noun cor) +{ + return u3qc_ham(u3x_atom(u3h(u3t(cor)))); +} diff --git a/vere/pkg/noun/jets/c/hew.c b/vere/pkg/noun/jets/c/hew.c new file mode 100644 index 0000000..be6b7a7 --- /dev/null +++ b/vere/pkg/noun/jets/c/hew.c @@ -0,0 +1,87 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static c3_w +_hew_in(c3_g a_g, + c3_w pos_w, + u3_atom vat, + u3_noun sam, + u3_noun* out) +{ + u3_noun h, t, *l, *r; + + while ( c3y == u3r_cell(sam, &h, &t) ) { + *out = u3i_defcons(&l, &r); + pos_w = _hew_in(a_g, pos_w, vat, h, l); + sam = t; + out = r; + } + + if ( !_(u3a_is_cat(sam)) ) { + return u3m_bail(c3__fail); + } + + if ( !sam ) { + *out = 0; + return pos_w; + } + else { + c3_w wid_w = (c3_w)sam; + c3_w new_w = pos_w + wid_w; + u3i_slab sab_u; + + if ( new_w < pos_w ) { + return u3m_bail(c3__fail); + } + + u3i_slab_init(&sab_u, a_g, wid_w); + u3r_chop(a_g, pos_w, wid_w, 0, sab_u.buf_w, vat); + + *out = u3i_slab_mint(&sab_u); + return new_w; + } +} + +u3_noun +u3qc_hew(u3_atom boq, + u3_atom sep, + u3_atom vat, + u3_noun sam) +{ + if ( !_(u3a_is_cat(boq)) || (boq >= 32) ) { + return u3m_bail(c3__fail); + } + + if ( !_(u3a_is_cat(sep)) ) { + return u3m_bail(c3__fail); + } + + u3_noun pro; + c3_w pos_w = _hew_in((c3_g)boq, (c3_w)sep, vat, sam, &pro); + return u3nt(pro, boq, u3i_word(pos_w)); +} + +u3_noun +u3wc_hew(u3_noun cor) +{ + u3_atom boq, sep, vat; + u3_noun sam; + { + u3_noun pay = u3t(cor); + u3_noun con = u3t(pay); + u3_noun gat = u3t(con); // outer gate + u3_noun cam = u3h(u3t(gat)); // outer sample + u3_noun d = u3h(con); + + boq = u3x_atom(u3h(d)); + sep = u3x_atom(u3t(d)); + vat = u3x_atom(u3t(cam)); + sam = u3h(pay); + } + + return u3qc_hew(boq, sep, vat, sam); +} diff --git a/vere/pkg/noun/jets/c/lsh.c b/vere/pkg/noun/jets/c/lsh.c new file mode 100644 index 0000000..09a97e6 --- /dev/null +++ b/vere/pkg/noun/jets/c/lsh.c @@ -0,0 +1,63 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_lsh(u3_atom a, + u3_atom b, + u3_atom c) +{ + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else if ( !_(u3a_is_cat(b)) ) { + return u3m_bail(c3__fail); + } + else { + c3_g a_g = a; + c3_w b_w = b; + c3_w len_w = u3r_met(a_g, c); + + if ( 0 == len_w ) { + return 0; + } + else if ( (b_w + len_w) < len_w ) { + return u3m_bail(c3__exit); + } + else { + u3i_slab sab_u; + u3i_slab_init(&sab_u, a_g, (b_w + len_w)); + + u3r_chop(a_g, 0, len_w, b_w, sab_u.buf_w, c); + + return u3i_slab_mint(&sab_u); + } + } +} + +u3_noun +u3wc_lsh(u3_noun cor) +{ + u3_atom bloq, step; + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0); + u3x_bite(a, &bloq, &step); + + return u3qc_lsh(bloq, step, u3x_atom(b)); +} + +u3_noun +u3kc_lsh(u3_noun a, + u3_noun b, + u3_noun c) +{ + u3_noun d = u3qc_lsh(a, b, c); + + u3z(a); u3z(b); u3z(c); + return d; +} diff --git a/vere/pkg/noun/jets/c/mas.c b/vere/pkg/noun/jets/c/mas.c new file mode 100644 index 0000000..b0be6e1 --- /dev/null +++ b/vere/pkg/noun/jets/c/mas.c @@ -0,0 +1,48 @@ +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_mas(u3_atom a) +{ + c3_w b_w; + + if ( c3y == u3a_is_cat(a) ) { + b_w = c3_bits_word(a); + + if ( 2 > b_w ) { + return u3m_bail(c3__exit); + } + else { + a &= ~((c3_w)1 << (b_w - 1)); + a |= ((c3_w)1 << (b_w - 2)); + return a; + } + } + else { + b_w = u3r_met(0, a); + + if ( 64 > b_w ) { + c3_d a_d = u3r_chub(0, a); + a_d &= ~((c3_d)1 << (b_w - 1)); + a_d |= ((c3_d)1 << (b_w - 2)); + return u3i_chub(a_d); + } + else { + u3i_slab sab_u; + u3i_slab_from(&sab_u, a, 0, b_w - 1); + + b_w -= 2; + sab_u.buf_w[(b_w >> 5)] |= ((c3_w)1 << (b_w & 31)); + + return u3i_slab_mint(&sab_u); + } + } +} + +u3_noun +u3wc_mas(u3_noun cor) +{ + return u3qc_mas(u3x_atom(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/c/met.c b/vere/pkg/noun/jets/c/met.c new file mode 100644 index 0000000..5f3a6a6 --- /dev/null +++ b/vere/pkg/noun/jets/c/met.c @@ -0,0 +1,42 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_met(u3_atom a, + u3_atom b) + { + if ( 0 == b ) { + return 0; + } + else if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail);; + } + else { + c3_w met_w = u3r_met(a, b); + + if ( !_(u3a_is_cat(met_w)) ) { + return u3i_words(1, &met_w); + } + else return met_w; + } + } + u3_noun + u3wc_met(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(b)) || + (c3n == u3ud(a) && 0 != b) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_met(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/mix.c b/vere/pkg/noun/jets/c/mix.c new file mode 100644 index 0000000..b497c3f --- /dev/null +++ b/vere/pkg/noun/jets/c/mix.c @@ -0,0 +1,56 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_mix(u3_atom a, + u3_atom b) + { + c3_w lna_w = u3r_met(5, a); + c3_w lnb_w = u3r_met(5, b); + + if ( (lna_w == 0) && (lnb_w == 0) ) { + return 0; + } + else { + c3_w len_w = c3_max(lna_w, lnb_w); + c3_w i_w; + u3i_slab sab_u; + u3i_slab_from(&sab_u, a, 5, len_w); + + // XX use u3r_chop for XOR? + // + for ( i_w = 0; i_w < lnb_w; i_w++ ) { + sab_u.buf_w[i_w] ^= u3r_word(i_w, b); + } + + return u3i_slab_mint(&sab_u); + } + } + u3_noun + u3wc_mix(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_mix(a, b); + } + } + u3_noun + u3kc_mix(u3_atom a, + u3_atom b) + { + u3_noun res = u3qc_mix(a, b); + u3z(a); u3z(b); + return res; + } diff --git a/vere/pkg/noun/jets/c/mor.c b/vere/pkg/noun/jets/c/mor.c new file mode 100644 index 0000000..97ba141 --- /dev/null +++ b/vere/pkg/noun/jets/c/mor.c @@ -0,0 +1,31 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_mor(u3_noun a, + u3_noun b) + { + c3_w c_w = u3r_mug(u3r_mug(a)); + c3_w d_w = u3r_mug(u3r_mug(b)); + + if ( c_w == d_w ) { + return u3qc_dor(a, b); + } + else return (c_w < d_w) ? c3y : c3n; + } + u3_noun + u3wc_mor(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { + return u3m_bail(c3__exit); + } else { + return u3qc_mor(a, b); + } + } diff --git a/vere/pkg/noun/jets/c/mug.c b/vere/pkg/noun/jets/c/mug.c new file mode 100644 index 0000000..ec6e483 --- /dev/null +++ b/vere/pkg/noun/jets/c/mug.c @@ -0,0 +1,19 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3wc_mug(u3_noun cor) + { + u3_noun sam; + + if ( u3_none == (sam = u3r_at(u3x_sam, cor)) ) { + return u3m_bail(c3__exit); + } else { + return u3r_mug(sam); + } + } diff --git a/vere/pkg/noun/jets/c/muk.c b/vere/pkg/noun/jets/c/muk.c new file mode 100644 index 0000000..0846ed7 --- /dev/null +++ b/vere/pkg/noun/jets/c/muk.c @@ -0,0 +1,76 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "murmur3.h" + +u3_noun +u3qc_muk(u3_atom sed, + u3_atom len, + u3_atom key) +{ + if ( c3n == u3a_is_cat(len) ) { + return u3m_bail(c3__fail); + } + else { + c3_w len_w = (c3_w)len; + c3_w key_w = u3r_met(3, key); + + // NB: this condition is implicit in the pad subtraction + // + if ( key_w > len_w ) { + return u3m_bail(c3__exit); + } + else { + c3_w sed_w = u3r_word(0, sed); + c3_o loc_o = c3n; + c3_y* key_y = 0; + c3_w out_w; + + // if we're hashing more bytes than we have, allocate and copy + // to ensure trailing null bytes + // + if ( len_w > key_w ) { + loc_o = c3y; + key_y = u3a_calloc(sizeof(c3_y), len_w); + u3r_bytes(0, len_w, key_y, key); + } + else if ( len_w > 0 ) { + // XX assumes little-endian + // + key_y = ( c3y == u3a_is_cat(key) ) + ? (c3_y*)&key + : (c3_y*)((u3a_atom*)u3a_to_ptr(key))->buf_w; + } + + MurmurHash3_x86_32(key_y, len_w, sed_w, &out_w); + + if ( c3y == loc_o ) { + u3a_free(key_y); + } + + return u3i_words(1, &out_w); + } + } +} + +u3_noun +u3wc_muk(u3_noun cor) +{ + u3_noun sed, len, key; + u3x_mean(cor, u3x_sam_2, &sed, + u3x_sam_6, &len, + u3x_sam_7, &key, 0); + + if ( (c3n == u3ud(sed)) + || (c3n == u3ud(len)) + || (c3n == u3ud(key)) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qc_muk(sed, len, key); + } +} diff --git a/vere/pkg/noun/jets/c/peg.c b/vere/pkg/noun/jets/c/peg.c new file mode 100644 index 0000000..a700752 --- /dev/null +++ b/vere/pkg/noun/jets/c/peg.c @@ -0,0 +1,66 @@ +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_peg(u3_atom a, u3_atom b) +{ + if ( (0 == a) || (0 == b) ) { + return u3m_bail(c3__exit); + } + else if ( 1 == b ) { + return u3k(a); + } + + c3_d a_d, b_d; + c3_w c_w; + + if ( (c3y == u3a_is_cat(a)) && (c3y == u3a_is_cat(b)) ) { + c_w = c3_bits_word(b) - 1; + a_d = a; + b_d = b; + } + else { + c3_w d_w = u3r_met(0, a); + c3_d e_d; + + c_w = u3r_met(0, b) - 1; + e_d = (c3_d)c_w + d_w; + + if ( 64 <= e_d ) { + u3i_slab sab_u; + u3i_slab_init(&sab_u, 0, e_d); + + u3r_chop(0, 0, c_w, 0, sab_u.buf_w, b); + u3r_chop(0, 0, d_w, c_w, sab_u.buf_w, a); + + return u3i_slab_moot(&sab_u); + } + + a_d = u3r_chub(0, a); + b_d = u3r_chub(0, b); + } + + b_d &= ((c3_d)1 << c_w) - 1; + a_d <<= c_w; + a_d ^= b_d; + + return u3i_chub(a_d); +} + +u3_noun +u3wc_peg(u3_noun cor) +{ + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(b)) || + (c3n == u3ud(a) && b != 1) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qc_peg(a, b); + } +} diff --git a/vere/pkg/noun/jets/c/po.c b/vere/pkg/noun/jets/c/po.c new file mode 100644 index 0000000..2fe8858 --- /dev/null +++ b/vere/pkg/noun/jets/c/po.c @@ -0,0 +1,1427 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3_po_find_prefix(c3_y one, c3_y two, c3_y three) { + switch (one) { + case 'b': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 238); + case 'l': return u3nc(0, 107); + case 'n': return u3nc(0, 92); + case 'r': return u3nc(0, 183); + case 't': return u3nc(0, 172); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 56); + case 'd': return u3nc(0, 106); + case 'l': return u3nc(0, 144); + case 'n': return u3nc(0, 2); + case 's': return u3nc(0, 60); + case 't': return u3nc(0, 182); + default: return 0; + } + case 'o': switch (three) { + case 'l': return u3nc(0, 45); + case 'n': return u3nc(0, 244); + case 'r': return u3nc(0, 188); + case 's': return u3nc(0, 171); + case 't': return u3nc(0, 98); + default: return 0; + } + default: return 0; + } + case 'd': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 181); + case 'c': return u3nc(0, 117); + case 'l': return u3nc(0, 37); + case 'n': return u3nc(0, 234); + case 'p': return u3nc(0, 66); + case 'r': return u3nc(0, 23); + case 's': return u3nc(0, 61); + case 't': return u3nc(0, 215); + case 'v': return u3nc(0, 105); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 179); + case 'f': return u3nc(0, 57); + case 'g': return u3nc(0, 193); + case 'l': return u3nc(0, 49); + case 'n': return u3nc(0, 217); + case 'r': return u3nc(0, 11); + case 's': return u3nc(0, 129); + case 'v': return u3nc(0, 116); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 146); + case 'l': return u3nc(0, 102); + case 'n': return u3nc(0, 233); + case 'p': return u3nc(0, 18); + case 'r': return u3nc(0, 24); + case 's': return u3nc(0, 187); + case 't': return u3nc(0, 47); + case 'v': return u3nc(0, 236); + case 'z': return u3nc(0, 0); + default: return 0; + } + default: return 0; + } + case 'f': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 120); + case 'd': return u3nc(0, 206); + case 'l': return u3nc(0, 152); + case 'm': return u3nc(0, 214); + case 'n': return u3nc(0, 158); + case 's': return u3nc(0, 195); + default: return 0; + } + case 'i': switch (three) { + case 'd': return u3nc(0, 8); + case 'g': return u3nc(0, 138); + case 'l': return u3nc(0, 194); + case 'n': return u3nc(0, 90); + case 'p': return u3nc(0, 255); + case 'r': return u3nc(0, 169); + case 't': return u3nc(0, 226); + default: return 0; + } + case 'o': switch (three) { + case 'd': return u3nc(0, 247); + case 'g': return u3nc(0, 20); + case 'l': return u3nc(0, 27); + case 'n': return u3nc(0, 91); + case 'p': return u3nc(0, 213); + case 'r': return u3nc(0, 50); + case 's': return u3nc(0, 46); + case 't': return u3nc(0, 221); + default: return 0; + } + default: return 0; + } + case 'h': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 209); + case 'c': return u3nc(0, 174); + case 'd': return u3nc(0, 145); + case 'l': return u3nc(0, 203); + case 'n': return u3nc(0, 41); + case 'p': return u3nc(0, 156); + case 'r': return u3nc(0, 198); + case 's': return u3nc(0, 170); + case 't': return u3nc(0, 218); + case 'v': return u3nc(0, 176); + default: return 0; + } + case 'i': switch (three) { + case 'd': return u3nc(0, 7); + case 'l': return u3nc(0, 190); + case 'n': return u3nc(0, 200); + default: return 0; + } + case 'o': switch (three) { + case 'b': return u3nc(0, 197); + case 'c': return u3nc(0, 223); + case 'd': return u3nc(0, 26); + case 'l': return u3nc(0, 32); + case 'p': return u3nc(0, 22); + case 's': return u3nc(0, 180); + default: return 0; + } + default: return 0; + } + case 'l': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 161); + case 'c': return u3nc(0, 34); + case 'd': return u3nc(0, 235); + case 'g': return u3nc(0, 205); + case 'n': return u3nc(0, 232); + case 'p': return u3nc(0, 240); + case 'r': return u3nc(0, 225); + case 's': return u3nc(0, 128); + case 't': return u3nc(0, 134); + case 'v': return u3nc(0, 252); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 39); + case 'd': return u3nc(0, 21); + case 'g': return u3nc(0, 111); + case 'n': return u3nc(0, 178); + case 's': return u3nc(0, 9); + case 't': return u3nc(0, 5); + case 'v': return u3nc(0, 36); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 69); + case 'd': return u3nc(0, 186); + case 'm': return u3nc(0, 166); + case 'n': return u3nc(0, 135); + case 'p': return u3nc(0, 63); + case 'r': return u3nc(0, 25); + case 's': return u3nc(0, 48); + default: return 0; + } + default: return 0; + } + case 'm': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 191); + case 'g': return u3nc(0, 103); + case 'l': return u3nc(0, 110); + case 'p': return u3nc(0, 130); + case 'r': return u3nc(0, 1); + case 's': return u3nc(0, 202); + case 't': return u3nc(0, 253); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 157); + case 'd': return u3nc(0, 62); + case 'g': return u3nc(0, 199); + case 'l': return u3nc(0, 212); + case 'n': return u3nc(0, 79); + case 'p': return u3nc(0, 254); + case 'r': return u3nc(0, 31); + case 's': return u3nc(0, 126); + case 't': return u3nc(0, 196); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 148); + case 'd': return u3nc(0, 19); + case 'g': return u3nc(0, 162); + case 'l': return u3nc(0, 67); + case 'n': return u3nc(0, 122); + case 'p': return u3nc(0, 208); + case 'r': return u3nc(0, 93); + case 's': return u3nc(0, 231); + case 't': return u3nc(0, 82); + default: return 0; + } + default: return 0; + } + case 'n': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 219); + case 'l': return u3nc(0, 230); + case 'm': return u3nc(0, 243); + case 'p': return u3nc(0, 87); + case 'r': return u3nc(0, 65); + case 't': return u3nc(0, 77); + case 'v': return u3nc(0, 137); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 140); + case 'd': return u3nc(0, 72); + case 'l': return u3nc(0, 210); + case 'm': return u3nc(0, 224); + case 's': return u3nc(0, 124); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 250); + case 'd': return u3nc(0, 136); + case 'l': return u3nc(0, 216); + case 'm': return u3nc(0, 139); + case 'p': return u3nc(0, 88); + case 'r': return u3nc(0, 97); + case 's': return u3nc(0, 211); + case 'v': return u3nc(0, 70); + default: return 0; + } + default: return 0; + } + case 'p': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 149); + case 'd': return u3nc(0, 114); + case 'g': return u3nc(0, 141); + case 'l': return u3nc(0, 127); + case 'n': return u3nc(0, 78); + case 'r': return u3nc(0, 185); + case 's': return u3nc(0, 33); + case 't': return u3nc(0, 159); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 104); + case 'd': return u3nc(0, 43); + case 'l': return u3nc(0, 51); + case 'n': return u3nc(0, 165); + case 't': return u3nc(0, 242); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 173); + case 'd': return u3nc(0, 81); + case 'l': return u3nc(0, 239); + case 'n': return u3nc(0, 248); + case 's': return u3nc(0, 86); + default: return 0; + } + default: return 0; + } + case 'r': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 131); + case 'c': return u3nc(0, 184); + case 'd': return u3nc(0, 201); + case 'g': return u3nc(0, 204); + case 'l': return u3nc(0, 143); + case 'm': return u3nc(0, 52); + case 'n': return u3nc(0, 123); + case 'p': return u3nc(0, 228); + case 'v': return u3nc(0, 150); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 222); + case 'c': return u3nc(0, 167); + case 'd': return u3nc(0, 147); + case 'g': return u3nc(0, 16); + case 'l': return u3nc(0, 64); + case 'n': return u3nc(0, 28); + case 'p': return u3nc(0, 151); + case 's': return u3nc(0, 220); + case 't': return u3nc(0, 80); + case 'v': return u3nc(0, 237); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 58); + case 'l': return u3nc(0, 133); + case 'n': return u3nc(0, 96); + case 'p': return u3nc(0, 75); + case 's': return u3nc(0, 245); + case 'v': return u3nc(0, 35); + default: return 0; + } + default: return 0; + } + case 's': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 13); + case 'l': return u3nc(0, 115); + case 'm': return u3nc(0, 4); + case 'n': return u3nc(0, 68); + case 'p': return u3nc(0, 177); + case 'r': return u3nc(0, 229); + case 't': return u3nc(0, 38); + case 'v': return u3nc(0, 85); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 15); + case 'c': return u3nc(0, 74); + case 'd': return u3nc(0, 119); + case 'g': return u3nc(0, 6); + case 'l': return u3nc(0, 30); + case 'm': return u3nc(0, 163); + case 'p': return u3nc(0, 95); + case 't': return u3nc(0, 71); + case 'v': return u3nc(0, 112); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 100); + case 'g': return u3nc(0, 10); + case 'l': return u3nc(0, 17); + case 'm': return u3nc(0, 89); + case 'n': return u3nc(0, 164); + case 'p': return u3nc(0, 142); + case 'r': return u3nc(0, 251); + case 'v': return u3nc(0, 249); + default: return 0; + } + default: return 0; + } + case 't': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 40); + case 'c': return u3nc(0, 160); + case 'd': return u3nc(0, 55); + case 'g': return u3nc(0, 113); + case 'l': return u3nc(0, 241); + case 'm': return u3nc(0, 83); + case 'n': return u3nc(0, 118); + case 'p': return u3nc(0, 168); + case 'r': return u3nc(0, 121); + case 's': return u3nc(0, 109); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 42); + case 'd': return u3nc(0, 175); + case 'l': return u3nc(0, 154); + case 'm': return u3nc(0, 108); + case 'n': return u3nc(0, 155); + case 'p': return u3nc(0, 73); + case 'r': return u3nc(0, 53); + default: return 0; + } + case 'o': switch (three) { + case 'b': return u3nc(0, 132); + case 'c': return u3nc(0, 189); + case 'd': return u3nc(0, 153); + case 'g': return u3nc(0, 29); + case 'l': return u3nc(0, 84); + case 'm': return u3nc(0, 192); + case 'n': return u3nc(0, 246); + case 'p': return u3nc(0, 207); + case 'r': return u3nc(0, 44); + default: return 0; + } + default: return 0; + } + case 'w': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 12); + case 'l': return u3nc(0, 227); + case 'n': return u3nc(0, 3); + case 't': return u3nc(0, 101); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 99); + case 'd': return u3nc(0, 59); + case 'n': return u3nc(0, 54); + case 's': return u3nc(0, 14); + case 't': return u3nc(0, 76); + default: return 0; + } + case 'o': switch (three) { + case 'l': return u3nc(0, 125); + case 'r': return u3nc(0, 94); + default: return 0; + } + default: return 0; + } + default: return 0; + } +} + +void +u3_po_to_prefix(u3_noun id, c3_y* a, c3_y* b, c3_y* c) +{ + switch (id) { + case 0: *a = 'd'; *b = 'o'; *c = 'z'; break; + case 1: *a = 'm'; *b = 'a'; *c = 'r'; break; + case 2: *a = 'b'; *b = 'i'; *c = 'n'; break; + case 3: *a = 'w'; *b = 'a'; *c = 'n'; break; + case 4: *a = 's'; *b = 'a'; *c = 'm'; break; + case 5: *a = 'l'; *b = 'i'; *c = 't'; break; + case 6: *a = 's'; *b = 'i'; *c = 'g'; break; + case 7: *a = 'h'; *b = 'i'; *c = 'd'; break; + case 8: *a = 'f'; *b = 'i'; *c = 'd'; break; + case 9: *a = 'l'; *b = 'i'; *c = 's'; break; + case 10: *a = 's'; *b = 'o'; *c = 'g'; break; + case 11: *a = 'd'; *b = 'i'; *c = 'r'; break; + case 12: *a = 'w'; *b = 'a'; *c = 'c'; break; + case 13: *a = 's'; *b = 'a'; *c = 'b'; break; + case 14: *a = 'w'; *b = 'i'; *c = 's'; break; + case 15: *a = 's'; *b = 'i'; *c = 'b'; break; + case 16: *a = 'r'; *b = 'i'; *c = 'g'; break; + case 17: *a = 's'; *b = 'o'; *c = 'l'; break; + case 18: *a = 'd'; *b = 'o'; *c = 'p'; break; + case 19: *a = 'm'; *b = 'o'; *c = 'd'; break; + case 20: *a = 'f'; *b = 'o'; *c = 'g'; break; + case 21: *a = 'l'; *b = 'i'; *c = 'd'; break; + case 22: *a = 'h'; *b = 'o'; *c = 'p'; break; + case 23: *a = 'd'; *b = 'a'; *c = 'r'; break; + case 24: *a = 'd'; *b = 'o'; *c = 'r'; break; + case 25: *a = 'l'; *b = 'o'; *c = 'r'; break; + case 26: *a = 'h'; *b = 'o'; *c = 'd'; break; + case 27: *a = 'f'; *b = 'o'; *c = 'l'; break; + case 28: *a = 'r'; *b = 'i'; *c = 'n'; break; + case 29: *a = 't'; *b = 'o'; *c = 'g'; break; + case 30: *a = 's'; *b = 'i'; *c = 'l'; break; + case 31: *a = 'm'; *b = 'i'; *c = 'r'; break; + case 32: *a = 'h'; *b = 'o'; *c = 'l'; break; + case 33: *a = 'p'; *b = 'a'; *c = 's'; break; + case 34: *a = 'l'; *b = 'a'; *c = 'c'; break; + case 35: *a = 'r'; *b = 'o'; *c = 'v'; break; + case 36: *a = 'l'; *b = 'i'; *c = 'v'; break; + case 37: *a = 'd'; *b = 'a'; *c = 'l'; break; + case 38: *a = 's'; *b = 'a'; *c = 't'; break; + case 39: *a = 'l'; *b = 'i'; *c = 'b'; break; + case 40: *a = 't'; *b = 'a'; *c = 'b'; break; + case 41: *a = 'h'; *b = 'a'; *c = 'n'; break; + case 42: *a = 't'; *b = 'i'; *c = 'c'; break; + case 43: *a = 'p'; *b = 'i'; *c = 'd'; break; + case 44: *a = 't'; *b = 'o'; *c = 'r'; break; + case 45: *a = 'b'; *b = 'o'; *c = 'l'; break; + case 46: *a = 'f'; *b = 'o'; *c = 's'; break; + case 47: *a = 'd'; *b = 'o'; *c = 't'; break; + case 48: *a = 'l'; *b = 'o'; *c = 's'; break; + case 49: *a = 'd'; *b = 'i'; *c = 'l'; break; + case 50: *a = 'f'; *b = 'o'; *c = 'r'; break; + case 51: *a = 'p'; *b = 'i'; *c = 'l'; break; + case 52: *a = 'r'; *b = 'a'; *c = 'm'; break; + case 53: *a = 't'; *b = 'i'; *c = 'r'; break; + case 54: *a = 'w'; *b = 'i'; *c = 'n'; break; + case 55: *a = 't'; *b = 'a'; *c = 'd'; break; + case 56: *a = 'b'; *b = 'i'; *c = 'c'; break; + case 57: *a = 'd'; *b = 'i'; *c = 'f'; break; + case 58: *a = 'r'; *b = 'o'; *c = 'c'; break; + case 59: *a = 'w'; *b = 'i'; *c = 'd'; break; + case 60: *a = 'b'; *b = 'i'; *c = 's'; break; + case 61: *a = 'd'; *b = 'a'; *c = 's'; break; + case 62: *a = 'm'; *b = 'i'; *c = 'd'; break; + case 63: *a = 'l'; *b = 'o'; *c = 'p'; break; + case 64: *a = 'r'; *b = 'i'; *c = 'l'; break; + case 65: *a = 'n'; *b = 'a'; *c = 'r'; break; + case 66: *a = 'd'; *b = 'a'; *c = 'p'; break; + case 67: *a = 'm'; *b = 'o'; *c = 'l'; break; + case 68: *a = 's'; *b = 'a'; *c = 'n'; break; + case 69: *a = 'l'; *b = 'o'; *c = 'c'; break; + case 70: *a = 'n'; *b = 'o'; *c = 'v'; break; + case 71: *a = 's'; *b = 'i'; *c = 't'; break; + case 72: *a = 'n'; *b = 'i'; *c = 'd'; break; + case 73: *a = 't'; *b = 'i'; *c = 'p'; break; + case 74: *a = 's'; *b = 'i'; *c = 'c'; break; + case 75: *a = 'r'; *b = 'o'; *c = 'p'; break; + case 76: *a = 'w'; *b = 'i'; *c = 't'; break; + case 77: *a = 'n'; *b = 'a'; *c = 't'; break; + case 78: *a = 'p'; *b = 'a'; *c = 'n'; break; + case 79: *a = 'm'; *b = 'i'; *c = 'n'; break; + case 80: *a = 'r'; *b = 'i'; *c = 't'; break; + case 81: *a = 'p'; *b = 'o'; *c = 'd'; break; + case 82: *a = 'm'; *b = 'o'; *c = 't'; break; + case 83: *a = 't'; *b = 'a'; *c = 'm'; break; + case 84: *a = 't'; *b = 'o'; *c = 'l'; break; + case 85: *a = 's'; *b = 'a'; *c = 'v'; break; + case 86: *a = 'p'; *b = 'o'; *c = 's'; break; + case 87: *a = 'n'; *b = 'a'; *c = 'p'; break; + case 88: *a = 'n'; *b = 'o'; *c = 'p'; break; + case 89: *a = 's'; *b = 'o'; *c = 'm'; break; + case 90: *a = 'f'; *b = 'i'; *c = 'n'; break; + case 91: *a = 'f'; *b = 'o'; *c = 'n'; break; + case 92: *a = 'b'; *b = 'a'; *c = 'n'; break; + case 93: *a = 'm'; *b = 'o'; *c = 'r'; break; + case 94: *a = 'w'; *b = 'o'; *c = 'r'; break; + case 95: *a = 's'; *b = 'i'; *c = 'p'; break; + case 96: *a = 'r'; *b = 'o'; *c = 'n'; break; + case 97: *a = 'n'; *b = 'o'; *c = 'r'; break; + case 98: *a = 'b'; *b = 'o'; *c = 't'; break; + case 99: *a = 'w'; *b = 'i'; *c = 'c'; break; + case 100: *a = 's'; *b = 'o'; *c = 'c'; break; + case 101: *a = 'w'; *b = 'a'; *c = 't'; break; + case 102: *a = 'd'; *b = 'o'; *c = 'l'; break; + case 103: *a = 'm'; *b = 'a'; *c = 'g'; break; + case 104: *a = 'p'; *b = 'i'; *c = 'c'; break; + case 105: *a = 'd'; *b = 'a'; *c = 'v'; break; + case 106: *a = 'b'; *b = 'i'; *c = 'd'; break; + case 107: *a = 'b'; *b = 'a'; *c = 'l'; break; + case 108: *a = 't'; *b = 'i'; *c = 'm'; break; + case 109: *a = 't'; *b = 'a'; *c = 's'; break; + case 110: *a = 'm'; *b = 'a'; *c = 'l'; break; + case 111: *a = 'l'; *b = 'i'; *c = 'g'; break; + case 112: *a = 's'; *b = 'i'; *c = 'v'; break; + case 113: *a = 't'; *b = 'a'; *c = 'g'; break; + case 114: *a = 'p'; *b = 'a'; *c = 'd'; break; + case 115: *a = 's'; *b = 'a'; *c = 'l'; break; + case 116: *a = 'd'; *b = 'i'; *c = 'v'; break; + case 117: *a = 'd'; *b = 'a'; *c = 'c'; break; + case 118: *a = 't'; *b = 'a'; *c = 'n'; break; + case 119: *a = 's'; *b = 'i'; *c = 'd'; break; + case 120: *a = 'f'; *b = 'a'; *c = 'b'; break; + case 121: *a = 't'; *b = 'a'; *c = 'r'; break; + case 122: *a = 'm'; *b = 'o'; *c = 'n'; break; + case 123: *a = 'r'; *b = 'a'; *c = 'n'; break; + case 124: *a = 'n'; *b = 'i'; *c = 's'; break; + case 125: *a = 'w'; *b = 'o'; *c = 'l'; break; + case 126: *a = 'm'; *b = 'i'; *c = 's'; break; + case 127: *a = 'p'; *b = 'a'; *c = 'l'; break; + case 128: *a = 'l'; *b = 'a'; *c = 's'; break; + case 129: *a = 'd'; *b = 'i'; *c = 's'; break; + case 130: *a = 'm'; *b = 'a'; *c = 'p'; break; + case 131: *a = 'r'; *b = 'a'; *c = 'b'; break; + case 132: *a = 't'; *b = 'o'; *c = 'b'; break; + case 133: *a = 'r'; *b = 'o'; *c = 'l'; break; + case 134: *a = 'l'; *b = 'a'; *c = 't'; break; + case 135: *a = 'l'; *b = 'o'; *c = 'n'; break; + case 136: *a = 'n'; *b = 'o'; *c = 'd'; break; + case 137: *a = 'n'; *b = 'a'; *c = 'v'; break; + case 138: *a = 'f'; *b = 'i'; *c = 'g'; break; + case 139: *a = 'n'; *b = 'o'; *c = 'm'; break; + case 140: *a = 'n'; *b = 'i'; *c = 'b'; break; + case 141: *a = 'p'; *b = 'a'; *c = 'g'; break; + case 142: *a = 's'; *b = 'o'; *c = 'p'; break; + case 143: *a = 'r'; *b = 'a'; *c = 'l'; break; + case 144: *a = 'b'; *b = 'i'; *c = 'l'; break; + case 145: *a = 'h'; *b = 'a'; *c = 'd'; break; + case 146: *a = 'd'; *b = 'o'; *c = 'c'; break; + case 147: *a = 'r'; *b = 'i'; *c = 'd'; break; + case 148: *a = 'm'; *b = 'o'; *c = 'c'; break; + case 149: *a = 'p'; *b = 'a'; *c = 'c'; break; + case 150: *a = 'r'; *b = 'a'; *c = 'v'; break; + case 151: *a = 'r'; *b = 'i'; *c = 'p'; break; + case 152: *a = 'f'; *b = 'a'; *c = 'l'; break; + case 153: *a = 't'; *b = 'o'; *c = 'd'; break; + case 154: *a = 't'; *b = 'i'; *c = 'l'; break; + case 155: *a = 't'; *b = 'i'; *c = 'n'; break; + case 156: *a = 'h'; *b = 'a'; *c = 'p'; break; + case 157: *a = 'm'; *b = 'i'; *c = 'c'; break; + case 158: *a = 'f'; *b = 'a'; *c = 'n'; break; + case 159: *a = 'p'; *b = 'a'; *c = 't'; break; + case 160: *a = 't'; *b = 'a'; *c = 'c'; break; + case 161: *a = 'l'; *b = 'a'; *c = 'b'; break; + case 162: *a = 'm'; *b = 'o'; *c = 'g'; break; + case 163: *a = 's'; *b = 'i'; *c = 'm'; break; + case 164: *a = 's'; *b = 'o'; *c = 'n'; break; + case 165: *a = 'p'; *b = 'i'; *c = 'n'; break; + case 166: *a = 'l'; *b = 'o'; *c = 'm'; break; + case 167: *a = 'r'; *b = 'i'; *c = 'c'; break; + case 168: *a = 't'; *b = 'a'; *c = 'p'; break; + case 169: *a = 'f'; *b = 'i'; *c = 'r'; break; + case 170: *a = 'h'; *b = 'a'; *c = 's'; break; + case 171: *a = 'b'; *b = 'o'; *c = 's'; break; + case 172: *a = 'b'; *b = 'a'; *c = 't'; break; + case 173: *a = 'p'; *b = 'o'; *c = 'c'; break; + case 174: *a = 'h'; *b = 'a'; *c = 'c'; break; + case 175: *a = 't'; *b = 'i'; *c = 'd'; break; + case 176: *a = 'h'; *b = 'a'; *c = 'v'; break; + case 177: *a = 's'; *b = 'a'; *c = 'p'; break; + case 178: *a = 'l'; *b = 'i'; *c = 'n'; break; + case 179: *a = 'd'; *b = 'i'; *c = 'b'; break; + case 180: *a = 'h'; *b = 'o'; *c = 's'; break; + case 181: *a = 'd'; *b = 'a'; *c = 'b'; break; + case 182: *a = 'b'; *b = 'i'; *c = 't'; break; + case 183: *a = 'b'; *b = 'a'; *c = 'r'; break; + case 184: *a = 'r'; *b = 'a'; *c = 'c'; break; + case 185: *a = 'p'; *b = 'a'; *c = 'r'; break; + case 186: *a = 'l'; *b = 'o'; *c = 'd'; break; + case 187: *a = 'd'; *b = 'o'; *c = 's'; break; + case 188: *a = 'b'; *b = 'o'; *c = 'r'; break; + case 189: *a = 't'; *b = 'o'; *c = 'c'; break; + case 190: *a = 'h'; *b = 'i'; *c = 'l'; break; + case 191: *a = 'm'; *b = 'a'; *c = 'c'; break; + case 192: *a = 't'; *b = 'o'; *c = 'm'; break; + case 193: *a = 'd'; *b = 'i'; *c = 'g'; break; + case 194: *a = 'f'; *b = 'i'; *c = 'l'; break; + case 195: *a = 'f'; *b = 'a'; *c = 's'; break; + case 196: *a = 'm'; *b = 'i'; *c = 't'; break; + case 197: *a = 'h'; *b = 'o'; *c = 'b'; break; + case 198: *a = 'h'; *b = 'a'; *c = 'r'; break; + case 199: *a = 'm'; *b = 'i'; *c = 'g'; break; + case 200: *a = 'h'; *b = 'i'; *c = 'n'; break; + case 201: *a = 'r'; *b = 'a'; *c = 'd'; break; + case 202: *a = 'm'; *b = 'a'; *c = 's'; break; + case 203: *a = 'h'; *b = 'a'; *c = 'l'; break; + case 204: *a = 'r'; *b = 'a'; *c = 'g'; break; + case 205: *a = 'l'; *b = 'a'; *c = 'g'; break; + case 206: *a = 'f'; *b = 'a'; *c = 'd'; break; + case 207: *a = 't'; *b = 'o'; *c = 'p'; break; + case 208: *a = 'm'; *b = 'o'; *c = 'p'; break; + case 209: *a = 'h'; *b = 'a'; *c = 'b'; break; + case 210: *a = 'n'; *b = 'i'; *c = 'l'; break; + case 211: *a = 'n'; *b = 'o'; *c = 's'; break; + case 212: *a = 'm'; *b = 'i'; *c = 'l'; break; + case 213: *a = 'f'; *b = 'o'; *c = 'p'; break; + case 214: *a = 'f'; *b = 'a'; *c = 'm'; break; + case 215: *a = 'd'; *b = 'a'; *c = 't'; break; + case 216: *a = 'n'; *b = 'o'; *c = 'l'; break; + case 217: *a = 'd'; *b = 'i'; *c = 'n'; break; + case 218: *a = 'h'; *b = 'a'; *c = 't'; break; + case 219: *a = 'n'; *b = 'a'; *c = 'c'; break; + case 220: *a = 'r'; *b = 'i'; *c = 's'; break; + case 221: *a = 'f'; *b = 'o'; *c = 't'; break; + case 222: *a = 'r'; *b = 'i'; *c = 'b'; break; + case 223: *a = 'h'; *b = 'o'; *c = 'c'; break; + case 224: *a = 'n'; *b = 'i'; *c = 'm'; break; + case 225: *a = 'l'; *b = 'a'; *c = 'r'; break; + case 226: *a = 'f'; *b = 'i'; *c = 't'; break; + case 227: *a = 'w'; *b = 'a'; *c = 'l'; break; + case 228: *a = 'r'; *b = 'a'; *c = 'p'; break; + case 229: *a = 's'; *b = 'a'; *c = 'r'; break; + case 230: *a = 'n'; *b = 'a'; *c = 'l'; break; + case 231: *a = 'm'; *b = 'o'; *c = 's'; break; + case 232: *a = 'l'; *b = 'a'; *c = 'n'; break; + case 233: *a = 'd'; *b = 'o'; *c = 'n'; break; + case 234: *a = 'd'; *b = 'a'; *c = 'n'; break; + case 235: *a = 'l'; *b = 'a'; *c = 'd'; break; + case 236: *a = 'd'; *b = 'o'; *c = 'v'; break; + case 237: *a = 'r'; *b = 'i'; *c = 'v'; break; + case 238: *a = 'b'; *b = 'a'; *c = 'c'; break; + case 239: *a = 'p'; *b = 'o'; *c = 'l'; break; + case 240: *a = 'l'; *b = 'a'; *c = 'p'; break; + case 241: *a = 't'; *b = 'a'; *c = 'l'; break; + case 242: *a = 'p'; *b = 'i'; *c = 't'; break; + case 243: *a = 'n'; *b = 'a'; *c = 'm'; break; + case 244: *a = 'b'; *b = 'o'; *c = 'n'; break; + case 245: *a = 'r'; *b = 'o'; *c = 's'; break; + case 246: *a = 't'; *b = 'o'; *c = 'n'; break; + case 247: *a = 'f'; *b = 'o'; *c = 'd'; break; + case 248: *a = 'p'; *b = 'o'; *c = 'n'; break; + case 249: *a = 's'; *b = 'o'; *c = 'v'; break; + case 250: *a = 'n'; *b = 'o'; *c = 'c'; break; + case 251: *a = 's'; *b = 'o'; *c = 'r'; break; + case 252: *a = 'l'; *b = 'a'; *c = 'v'; break; + case 253: *a = 'm'; *b = 'a'; *c = 't'; break; + case 254: *a = 'm'; *b = 'i'; *c = 'p'; break; + case 255: *a = 'f'; *b = 'i'; *c = 'p'; break; + default: u3m_bail(c3__exit); + } +} + +u3_noun +u3_po_find_suffix(c3_y one, c3_y two, c3_y three) { + switch (one) { + case 'b': switch (two) { + case 'e': switch (three) { + case 'c': return u3nc(0, 238); + case 'l': return u3nc(0, 107); + case 'n': return u3nc(0, 92); + case 'p': return u3nc(0, 183); + case 'r': return u3nc(0, 172); + case 's': return u3nc(0, 56); + case 't': return u3nc(0, 106); + case 'x': return u3nc(0, 144); + default: return 0; + } + case 'u': switch (three) { + case 'd': return u3nc(0, 2); + case 'r': return u3nc(0, 60); + case 's': return u3nc(0, 182); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 176); + case 'n': return u3nc(0, 45); + case 'r': return u3nc(0, 244); + case 't': return u3nc(0, 188); + default: return 0; + } + default: return 0; + } + case 'd': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 171); + case 'c': return u3nc(0, 98); + case 'f': return u3nc(0, 181); + case 'g': return u3nc(0, 117); + case 'l': return u3nc(0, 37); + case 'm': return u3nc(0, 234); + case 'n': return u3nc(0, 66); + case 'p': return u3nc(0, 23); + case 'r': return u3nc(0, 61); + case 's': return u3nc(0, 215); + case 't': return u3nc(0, 105); + case 'v': return u3nc(0, 179); + case 'x': return u3nc(0, 57); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 193); + case 'l': return u3nc(0, 49); + case 'n': return u3nc(0, 217); + case 'r': return u3nc(0, 11); + case 's': return u3nc(0, 129); + case 't': return u3nc(0, 116); + case 'x': return u3nc(0, 146); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 102); + case 'n': return u3nc(0, 233); + case 'r': return u3nc(0, 18); + case 's': return u3nc(0, 24); + case 't': return u3nc(0, 187); + default: return 0; + } + default: return 0; + } + case 'f': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 47); + case 'd': return u3nc(0, 236); + case 'l': return u3nc(0, 120); + case 'n': return u3nc(0, 206); + case 'p': return u3nc(0, 152); + case 'r': return u3nc(0, 158); + case 's': return u3nc(0, 255); + case 't': return u3nc(0, 214); + case 'x': return u3nc(0, 195); + default: return 0; + } + case 'u': switch (three) { + case 'l': return u3nc(0, 8); + case 'n': return u3nc(0, 138); + case 'r': return u3nc(0, 194); + case 's': return u3nc(0, 90); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 169); + case 'n': return u3nc(0, 226); + case 'r': return u3nc(0, 247); + default: return 0; + } + default: return 0; + } + case 'h': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 20); + case 'c': return u3nc(0, 27); + case 'p': return u3nc(0, 91); + case 's': return u3nc(0, 213); + case 't': return u3nc(0, 50); + case 'x': return u3nc(0, 46); + default: return 0; + } + case 'u': switch (three) { + case 'l': return u3nc(0, 221); + case 's': return u3nc(0, 209); + case 't': return u3nc(0, 174); + default: return 0; + } + default: return 0; + } + case 'l': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 145); + case 'c': return u3nc(0, 203); + case 'd': return u3nc(0, 41); + case 'g': return u3nc(0, 156); + case 'n': return u3nc(0, 198); + case 'p': return u3nc(0, 170); + case 'r': return u3nc(0, 218); + case 't': return u3nc(0, 7); + case 'v': return u3nc(0, 190); + case 'x': return u3nc(0, 200); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 197); + case 'd': return u3nc(0, 223); + case 'g': return u3nc(0, 26); + case 'n': return u3nc(0, 32); + case 'p': return u3nc(0, 22); + case 'r': return u3nc(0, 180); + case 's': return u3nc(0, 161); + case 't': return u3nc(0, 34); + case 'x': return u3nc(0, 235); + default: return 0; + } + case 'y': switch (three) { + case 'd': return u3nc(0, 205); + case 'n': return u3nc(0, 232); + case 'r': return u3nc(0, 240); + case 's': return u3nc(0, 225); + case 't': return u3nc(0, 128); + case 'x': return u3nc(0, 134); + default: return 0; + } + default: return 0; + } + case 'm': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 114); + case 'c': return u3nc(0, 141); + case 'd': return u3nc(0, 127); + case 'g': return u3nc(0, 78); + case 'l': return u3nc(0, 185); + case 'p': return u3nc(0, 33); + case 'r': return u3nc(0, 159); + case 's': return u3nc(0, 104); + case 't': return u3nc(0, 43); + case 'v': return u3nc(0, 51); + case 'x': return u3nc(0, 165); + default: return 0; + } + case 'u': switch (three) { + case 'd': return u3nc(0, 242); + case 'g': return u3nc(0, 173); + case 'l': return u3nc(0, 81); + case 'n': return u3nc(0, 239); + case 'r': return u3nc(0, 248); + case 's': return u3nc(0, 93); + case 't': return u3nc(0, 86); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 191); + case 'n': return u3nc(0, 103); + case 'r': return u3nc(0, 110); + default: return 0; + } + default: return 0; + } + case 'n': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 130); + case 'c': return u3nc(0, 1); + case 'd': return u3nc(0, 202); + case 'l': return u3nc(0, 253); + case 'm': return u3nc(0, 157); + case 'p': return u3nc(0, 62); + case 'r': return u3nc(0, 199); + case 's': return u3nc(0, 212); + case 't': return u3nc(0, 79); + case 'v': return u3nc(0, 254); + case 'x': return u3nc(0, 31); + default: return 0; + } + case 'u': switch (three) { + case 'b': return u3nc(0, 126); + case 'l': return u3nc(0, 196); + case 'm': return u3nc(0, 148); + case 'p': return u3nc(0, 19); + case 's': return u3nc(0, 162); + case 't': return u3nc(0, 67); + case 'x': return u3nc(0, 122); + default: return 0; + } + case 'y': switch (three) { + case 'd': return u3nc(0, 208); + case 'l': return u3nc(0, 231); + case 'm': return u3nc(0, 82); + case 'r': return u3nc(0, 219); + case 's': return u3nc(0, 230); + case 't': return u3nc(0, 243); + case 'x': return u3nc(0, 87); + default: return 0; + } + default: return 0; + } + case 'p': switch (two) { + case 'e': switch (three) { + case 'c': return u3nc(0, 252); + case 'd': return u3nc(0, 39); + case 'g': return u3nc(0, 21); + case 'l': return u3nc(0, 111); + case 'm': return u3nc(0, 178); + case 'n': return u3nc(0, 9); + case 'r': return u3nc(0, 5); + case 's': return u3nc(0, 36); + case 't': return u3nc(0, 69); + case 'x': return u3nc(0, 186); + default: return 0; + } + case 'u': switch (three) { + case 'b': return u3nc(0, 166); + case 'n': return u3nc(0, 135); + case 'r': return u3nc(0, 63); + case 't': return u3nc(0, 25); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 48); + case 'x': return u3nc(0, 149); + default: return 0; + } + default: return 0; + } + case 'r': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 65); + case 'c': return u3nc(0, 77); + case 'd': return u3nc(0, 137); + case 'f': return u3nc(0, 140); + case 'g': return u3nc(0, 72); + case 'l': return u3nc(0, 210); + case 'm': return u3nc(0, 224); + case 'n': return u3nc(0, 124); + case 'p': return u3nc(0, 250); + case 's': return u3nc(0, 136); + case 't': return u3nc(0, 216); + case 'v': return u3nc(0, 139); + case 'x': return u3nc(0, 88); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 97); + case 'd': return u3nc(0, 211); + case 'l': return u3nc(0, 70); + case 'm': return u3nc(0, 131); + case 'n': return u3nc(0, 184); + case 'p': return u3nc(0, 201); + case 's': return u3nc(0, 143); + case 't': return u3nc(0, 52); + case 'x': return u3nc(0, 123); + default: return 0; + } + case 'y': switch (three) { + case 'c': return u3nc(0, 228); + case 'd': return u3nc(0, 204); + case 'g': return u3nc(0, 150); + case 'l': return u3nc(0, 222); + case 'm': return u3nc(0, 167); + case 'n': return u3nc(0, 147); + case 'p': return u3nc(0, 16); + case 's': return u3nc(0, 64); + case 't': return u3nc(0, 28); + case 'x': return u3nc(0, 151); + default: return 0; + } + default: return 0; + } + case 's': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 220); + case 'c': return u3nc(0, 80); + case 'd': return u3nc(0, 237); + case 'f': return u3nc(0, 58); + case 'g': return u3nc(0, 133); + case 'l': return u3nc(0, 96); + case 'm': return u3nc(0, 75); + case 'n': return u3nc(0, 245); + case 'p': return u3nc(0, 35); + case 'r': return u3nc(0, 13); + case 't': return u3nc(0, 115); + case 'v': return u3nc(0, 4); + default: return 0; + } + case 'u': switch (three) { + case 'b': return u3nc(0, 68); + case 'd': return u3nc(0, 177); + case 'g': return u3nc(0, 229); + case 'l': return u3nc(0, 38); + case 'm': return u3nc(0, 85); + case 'n': return u3nc(0, 15); + case 'p': return u3nc(0, 74); + case 'r': return u3nc(0, 119); + case 't': return u3nc(0, 6); + default: return 0; + } + case 'y': switch (three) { + case 'd': return u3nc(0, 30); + case 'l': return u3nc(0, 163); + case 'm': return u3nc(0, 95); + case 'n': return u3nc(0, 71); + case 'p': return u3nc(0, 112); + case 'r': return u3nc(0, 100); + case 't': return u3nc(0, 10); + case 'x': return u3nc(0, 17); + default: return 0; + } + default: return 0; + } + case 't': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 89); + case 'c': return u3nc(0, 164); + case 'd': return u3nc(0, 142); + case 'g': return u3nc(0, 251); + case 'l': return u3nc(0, 249); + case 'm': return u3nc(0, 40); + case 'n': return u3nc(0, 160); + case 'p': return u3nc(0, 55); + case 'r': return u3nc(0, 113); + case 's': return u3nc(0, 241); + case 'v': return u3nc(0, 83); + case 'x': return u3nc(0, 118); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 168); + case 'd': return u3nc(0, 121); + case 'g': return u3nc(0, 109); + case 'l': return u3nc(0, 42); + case 'n': return u3nc(0, 175); + case 's': return u3nc(0, 154); + case 'x': return u3nc(0, 108); + default: return 0; + } + case 'y': switch (three) { + case 'c': return u3nc(0, 155); + case 'd': return u3nc(0, 73); + case 'l': return u3nc(0, 53); + case 'n': return u3nc(0, 132); + case 'p': return u3nc(0, 189); + case 'r': return u3nc(0, 153); + case 'v': return u3nc(0, 29); + default: return 0; + } + default: return 0; + } + case 'w': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 84); + case 'd': return u3nc(0, 192); + case 'g': return u3nc(0, 246); + case 'l': return u3nc(0, 207); + case 'n': return u3nc(0, 44); + case 'p': return u3nc(0, 12); + case 'r': return u3nc(0, 227); + case 's': return u3nc(0, 3); + case 't': return u3nc(0, 101); + case 'x': return u3nc(0, 99); + default: return 0; + } + case 'y': switch (three) { + case 'c': return u3nc(0, 59); + case 'd': return u3nc(0, 54); + case 'l': return u3nc(0, 14); + case 'n': return u3nc(0, 76); + case 't': return u3nc(0, 125); + case 'x': return u3nc(0, 94); + default: return 0; + } + default: return 0; + } + case 'z': switch (two) { + case 'o': switch (three) { + case 'd': return u3nc(0, 0); + default: return 0; + } + default: return 0; + } + default: return 0; + } +} + +void +u3_po_to_suffix(u3_noun id, c3_y* a, c3_y* b, c3_y* c) +{ + switch (id) { + case 0: *a = 'z'; *b = 'o'; *c = 'd'; break; + case 1: *a = 'n'; *b = 'e'; *c = 'c'; break; + case 2: *a = 'b'; *b = 'u'; *c = 'd'; break; + case 3: *a = 'w'; *b = 'e'; *c = 's'; break; + case 4: *a = 's'; *b = 'e'; *c = 'v'; break; + case 5: *a = 'p'; *b = 'e'; *c = 'r'; break; + case 6: *a = 's'; *b = 'u'; *c = 't'; break; + case 7: *a = 'l'; *b = 'e'; *c = 't'; break; + case 8: *a = 'f'; *b = 'u'; *c = 'l'; break; + case 9: *a = 'p'; *b = 'e'; *c = 'n'; break; + case 10: *a = 's'; *b = 'y'; *c = 't'; break; + case 11: *a = 'd'; *b = 'u'; *c = 'r'; break; + case 12: *a = 'w'; *b = 'e'; *c = 'p'; break; + case 13: *a = 's'; *b = 'e'; *c = 'r'; break; + case 14: *a = 'w'; *b = 'y'; *c = 'l'; break; + case 15: *a = 's'; *b = 'u'; *c = 'n'; break; + case 16: *a = 'r'; *b = 'y'; *c = 'p'; break; + case 17: *a = 's'; *b = 'y'; *c = 'x'; break; + case 18: *a = 'd'; *b = 'y'; *c = 'r'; break; + case 19: *a = 'n'; *b = 'u'; *c = 'p'; break; + case 20: *a = 'h'; *b = 'e'; *c = 'b'; break; + case 21: *a = 'p'; *b = 'e'; *c = 'g'; break; + case 22: *a = 'l'; *b = 'u'; *c = 'p'; break; + case 23: *a = 'd'; *b = 'e'; *c = 'p'; break; + case 24: *a = 'd'; *b = 'y'; *c = 's'; break; + case 25: *a = 'p'; *b = 'u'; *c = 't'; break; + case 26: *a = 'l'; *b = 'u'; *c = 'g'; break; + case 27: *a = 'h'; *b = 'e'; *c = 'c'; break; + case 28: *a = 'r'; *b = 'y'; *c = 't'; break; + case 29: *a = 't'; *b = 'y'; *c = 'v'; break; + case 30: *a = 's'; *b = 'y'; *c = 'd'; break; + case 31: *a = 'n'; *b = 'e'; *c = 'x'; break; + case 32: *a = 'l'; *b = 'u'; *c = 'n'; break; + case 33: *a = 'm'; *b = 'e'; *c = 'p'; break; + case 34: *a = 'l'; *b = 'u'; *c = 't'; break; + case 35: *a = 's'; *b = 'e'; *c = 'p'; break; + case 36: *a = 'p'; *b = 'e'; *c = 's'; break; + case 37: *a = 'd'; *b = 'e'; *c = 'l'; break; + case 38: *a = 's'; *b = 'u'; *c = 'l'; break; + case 39: *a = 'p'; *b = 'e'; *c = 'd'; break; + case 40: *a = 't'; *b = 'e'; *c = 'm'; break; + case 41: *a = 'l'; *b = 'e'; *c = 'd'; break; + case 42: *a = 't'; *b = 'u'; *c = 'l'; break; + case 43: *a = 'm'; *b = 'e'; *c = 't'; break; + case 44: *a = 'w'; *b = 'e'; *c = 'n'; break; + case 45: *a = 'b'; *b = 'y'; *c = 'n'; break; + case 46: *a = 'h'; *b = 'e'; *c = 'x'; break; + case 47: *a = 'f'; *b = 'e'; *c = 'b'; break; + case 48: *a = 'p'; *b = 'y'; *c = 'l'; break; + case 49: *a = 'd'; *b = 'u'; *c = 'l'; break; + case 50: *a = 'h'; *b = 'e'; *c = 't'; break; + case 51: *a = 'm'; *b = 'e'; *c = 'v'; break; + case 52: *a = 'r'; *b = 'u'; *c = 't'; break; + case 53: *a = 't'; *b = 'y'; *c = 'l'; break; + case 54: *a = 'w'; *b = 'y'; *c = 'd'; break; + case 55: *a = 't'; *b = 'e'; *c = 'p'; break; + case 56: *a = 'b'; *b = 'e'; *c = 's'; break; + case 57: *a = 'd'; *b = 'e'; *c = 'x'; break; + case 58: *a = 's'; *b = 'e'; *c = 'f'; break; + case 59: *a = 'w'; *b = 'y'; *c = 'c'; break; + case 60: *a = 'b'; *b = 'u'; *c = 'r'; break; + case 61: *a = 'd'; *b = 'e'; *c = 'r'; break; + case 62: *a = 'n'; *b = 'e'; *c = 'p'; break; + case 63: *a = 'p'; *b = 'u'; *c = 'r'; break; + case 64: *a = 'r'; *b = 'y'; *c = 's'; break; + case 65: *a = 'r'; *b = 'e'; *c = 'b'; break; + case 66: *a = 'd'; *b = 'e'; *c = 'n'; break; + case 67: *a = 'n'; *b = 'u'; *c = 't'; break; + case 68: *a = 's'; *b = 'u'; *c = 'b'; break; + case 69: *a = 'p'; *b = 'e'; *c = 't'; break; + case 70: *a = 'r'; *b = 'u'; *c = 'l'; break; + case 71: *a = 's'; *b = 'y'; *c = 'n'; break; + case 72: *a = 'r'; *b = 'e'; *c = 'g'; break; + case 73: *a = 't'; *b = 'y'; *c = 'd'; break; + case 74: *a = 's'; *b = 'u'; *c = 'p'; break; + case 75: *a = 's'; *b = 'e'; *c = 'm'; break; + case 76: *a = 'w'; *b = 'y'; *c = 'n'; break; + case 77: *a = 'r'; *b = 'e'; *c = 'c'; break; + case 78: *a = 'm'; *b = 'e'; *c = 'g'; break; + case 79: *a = 'n'; *b = 'e'; *c = 't'; break; + case 80: *a = 's'; *b = 'e'; *c = 'c'; break; + case 81: *a = 'm'; *b = 'u'; *c = 'l'; break; + case 82: *a = 'n'; *b = 'y'; *c = 'm'; break; + case 83: *a = 't'; *b = 'e'; *c = 'v'; break; + case 84: *a = 'w'; *b = 'e'; *c = 'b'; break; + case 85: *a = 's'; *b = 'u'; *c = 'm'; break; + case 86: *a = 'm'; *b = 'u'; *c = 't'; break; + case 87: *a = 'n'; *b = 'y'; *c = 'x'; break; + case 88: *a = 'r'; *b = 'e'; *c = 'x'; break; + case 89: *a = 't'; *b = 'e'; *c = 'b'; break; + case 90: *a = 'f'; *b = 'u'; *c = 's'; break; + case 91: *a = 'h'; *b = 'e'; *c = 'p'; break; + case 92: *a = 'b'; *b = 'e'; *c = 'n'; break; + case 93: *a = 'm'; *b = 'u'; *c = 's'; break; + case 94: *a = 'w'; *b = 'y'; *c = 'x'; break; + case 95: *a = 's'; *b = 'y'; *c = 'm'; break; + case 96: *a = 's'; *b = 'e'; *c = 'l'; break; + case 97: *a = 'r'; *b = 'u'; *c = 'c'; break; + case 98: *a = 'd'; *b = 'e'; *c = 'c'; break; + case 99: *a = 'w'; *b = 'e'; *c = 'x'; break; + case 100: *a = 's'; *b = 'y'; *c = 'r'; break; + case 101: *a = 'w'; *b = 'e'; *c = 't'; break; + case 102: *a = 'd'; *b = 'y'; *c = 'l'; break; + case 103: *a = 'm'; *b = 'y'; *c = 'n'; break; + case 104: *a = 'm'; *b = 'e'; *c = 's'; break; + case 105: *a = 'd'; *b = 'e'; *c = 't'; break; + case 106: *a = 'b'; *b = 'e'; *c = 't'; break; + case 107: *a = 'b'; *b = 'e'; *c = 'l'; break; + case 108: *a = 't'; *b = 'u'; *c = 'x'; break; + case 109: *a = 't'; *b = 'u'; *c = 'g'; break; + case 110: *a = 'm'; *b = 'y'; *c = 'r'; break; + case 111: *a = 'p'; *b = 'e'; *c = 'l'; break; + case 112: *a = 's'; *b = 'y'; *c = 'p'; break; + case 113: *a = 't'; *b = 'e'; *c = 'r'; break; + case 114: *a = 'm'; *b = 'e'; *c = 'b'; break; + case 115: *a = 's'; *b = 'e'; *c = 't'; break; + case 116: *a = 'd'; *b = 'u'; *c = 't'; break; + case 117: *a = 'd'; *b = 'e'; *c = 'g'; break; + case 118: *a = 't'; *b = 'e'; *c = 'x'; break; + case 119: *a = 's'; *b = 'u'; *c = 'r'; break; + case 120: *a = 'f'; *b = 'e'; *c = 'l'; break; + case 121: *a = 't'; *b = 'u'; *c = 'd'; break; + case 122: *a = 'n'; *b = 'u'; *c = 'x'; break; + case 123: *a = 'r'; *b = 'u'; *c = 'x'; break; + case 124: *a = 'r'; *b = 'e'; *c = 'n'; break; + case 125: *a = 'w'; *b = 'y'; *c = 't'; break; + case 126: *a = 'n'; *b = 'u'; *c = 'b'; break; + case 127: *a = 'm'; *b = 'e'; *c = 'd'; break; + case 128: *a = 'l'; *b = 'y'; *c = 't'; break; + case 129: *a = 'd'; *b = 'u'; *c = 's'; break; + case 130: *a = 'n'; *b = 'e'; *c = 'b'; break; + case 131: *a = 'r'; *b = 'u'; *c = 'm'; break; + case 132: *a = 't'; *b = 'y'; *c = 'n'; break; + case 133: *a = 's'; *b = 'e'; *c = 'g'; break; + case 134: *a = 'l'; *b = 'y'; *c = 'x'; break; + case 135: *a = 'p'; *b = 'u'; *c = 'n'; break; + case 136: *a = 'r'; *b = 'e'; *c = 's'; break; + case 137: *a = 'r'; *b = 'e'; *c = 'd'; break; + case 138: *a = 'f'; *b = 'u'; *c = 'n'; break; + case 139: *a = 'r'; *b = 'e'; *c = 'v'; break; + case 140: *a = 'r'; *b = 'e'; *c = 'f'; break; + case 141: *a = 'm'; *b = 'e'; *c = 'c'; break; + case 142: *a = 't'; *b = 'e'; *c = 'd'; break; + case 143: *a = 'r'; *b = 'u'; *c = 's'; break; + case 144: *a = 'b'; *b = 'e'; *c = 'x'; break; + case 145: *a = 'l'; *b = 'e'; *c = 'b'; break; + case 146: *a = 'd'; *b = 'u'; *c = 'x'; break; + case 147: *a = 'r'; *b = 'y'; *c = 'n'; break; + case 148: *a = 'n'; *b = 'u'; *c = 'm'; break; + case 149: *a = 'p'; *b = 'y'; *c = 'x'; break; + case 150: *a = 'r'; *b = 'y'; *c = 'g'; break; + case 151: *a = 'r'; *b = 'y'; *c = 'x'; break; + case 152: *a = 'f'; *b = 'e'; *c = 'p'; break; + case 153: *a = 't'; *b = 'y'; *c = 'r'; break; + case 154: *a = 't'; *b = 'u'; *c = 's'; break; + case 155: *a = 't'; *b = 'y'; *c = 'c'; break; + case 156: *a = 'l'; *b = 'e'; *c = 'g'; break; + case 157: *a = 'n'; *b = 'e'; *c = 'm'; break; + case 158: *a = 'f'; *b = 'e'; *c = 'r'; break; + case 159: *a = 'm'; *b = 'e'; *c = 'r'; break; + case 160: *a = 't'; *b = 'e'; *c = 'n'; break; + case 161: *a = 'l'; *b = 'u'; *c = 's'; break; + case 162: *a = 'n'; *b = 'u'; *c = 's'; break; + case 163: *a = 's'; *b = 'y'; *c = 'l'; break; + case 164: *a = 't'; *b = 'e'; *c = 'c'; break; + case 165: *a = 'm'; *b = 'e'; *c = 'x'; break; + case 166: *a = 'p'; *b = 'u'; *c = 'b'; break; + case 167: *a = 'r'; *b = 'y'; *c = 'm'; break; + case 168: *a = 't'; *b = 'u'; *c = 'c'; break; + case 169: *a = 'f'; *b = 'y'; *c = 'l'; break; + case 170: *a = 'l'; *b = 'e'; *c = 'p'; break; + case 171: *a = 'd'; *b = 'e'; *c = 'b'; break; + case 172: *a = 'b'; *b = 'e'; *c = 'r'; break; + case 173: *a = 'm'; *b = 'u'; *c = 'g'; break; + case 174: *a = 'h'; *b = 'u'; *c = 't'; break; + case 175: *a = 't'; *b = 'u'; *c = 'n'; break; + case 176: *a = 'b'; *b = 'y'; *c = 'l'; break; + case 177: *a = 's'; *b = 'u'; *c = 'd'; break; + case 178: *a = 'p'; *b = 'e'; *c = 'm'; break; + case 179: *a = 'd'; *b = 'e'; *c = 'v'; break; + case 180: *a = 'l'; *b = 'u'; *c = 'r'; break; + case 181: *a = 'd'; *b = 'e'; *c = 'f'; break; + case 182: *a = 'b'; *b = 'u'; *c = 's'; break; + case 183: *a = 'b'; *b = 'e'; *c = 'p'; break; + case 184: *a = 'r'; *b = 'u'; *c = 'n'; break; + case 185: *a = 'm'; *b = 'e'; *c = 'l'; break; + case 186: *a = 'p'; *b = 'e'; *c = 'x'; break; + case 187: *a = 'd'; *b = 'y'; *c = 't'; break; + case 188: *a = 'b'; *b = 'y'; *c = 't'; break; + case 189: *a = 't'; *b = 'y'; *c = 'p'; break; + case 190: *a = 'l'; *b = 'e'; *c = 'v'; break; + case 191: *a = 'm'; *b = 'y'; *c = 'l'; break; + case 192: *a = 'w'; *b = 'e'; *c = 'd'; break; + case 193: *a = 'd'; *b = 'u'; *c = 'c'; break; + case 194: *a = 'f'; *b = 'u'; *c = 'r'; break; + case 195: *a = 'f'; *b = 'e'; *c = 'x'; break; + case 196: *a = 'n'; *b = 'u'; *c = 'l'; break; + case 197: *a = 'l'; *b = 'u'; *c = 'c'; break; + case 198: *a = 'l'; *b = 'e'; *c = 'n'; break; + case 199: *a = 'n'; *b = 'e'; *c = 'r'; break; + case 200: *a = 'l'; *b = 'e'; *c = 'x'; break; + case 201: *a = 'r'; *b = 'u'; *c = 'p'; break; + case 202: *a = 'n'; *b = 'e'; *c = 'd'; break; + case 203: *a = 'l'; *b = 'e'; *c = 'c'; break; + case 204: *a = 'r'; *b = 'y'; *c = 'd'; break; + case 205: *a = 'l'; *b = 'y'; *c = 'd'; break; + case 206: *a = 'f'; *b = 'e'; *c = 'n'; break; + case 207: *a = 'w'; *b = 'e'; *c = 'l'; break; + case 208: *a = 'n'; *b = 'y'; *c = 'd'; break; + case 209: *a = 'h'; *b = 'u'; *c = 's'; break; + case 210: *a = 'r'; *b = 'e'; *c = 'l'; break; + case 211: *a = 'r'; *b = 'u'; *c = 'd'; break; + case 212: *a = 'n'; *b = 'e'; *c = 's'; break; + case 213: *a = 'h'; *b = 'e'; *c = 's'; break; + case 214: *a = 'f'; *b = 'e'; *c = 't'; break; + case 215: *a = 'd'; *b = 'e'; *c = 's'; break; + case 216: *a = 'r'; *b = 'e'; *c = 't'; break; + case 217: *a = 'd'; *b = 'u'; *c = 'n'; break; + case 218: *a = 'l'; *b = 'e'; *c = 'r'; break; + case 219: *a = 'n'; *b = 'y'; *c = 'r'; break; + case 220: *a = 's'; *b = 'e'; *c = 'b'; break; + case 221: *a = 'h'; *b = 'u'; *c = 'l'; break; + case 222: *a = 'r'; *b = 'y'; *c = 'l'; break; + case 223: *a = 'l'; *b = 'u'; *c = 'd'; break; + case 224: *a = 'r'; *b = 'e'; *c = 'm'; break; + case 225: *a = 'l'; *b = 'y'; *c = 's'; break; + case 226: *a = 'f'; *b = 'y'; *c = 'n'; break; + case 227: *a = 'w'; *b = 'e'; *c = 'r'; break; + case 228: *a = 'r'; *b = 'y'; *c = 'c'; break; + case 229: *a = 's'; *b = 'u'; *c = 'g'; break; + case 230: *a = 'n'; *b = 'y'; *c = 's'; break; + case 231: *a = 'n'; *b = 'y'; *c = 'l'; break; + case 232: *a = 'l'; *b = 'y'; *c = 'n'; break; + case 233: *a = 'd'; *b = 'y'; *c = 'n'; break; + case 234: *a = 'd'; *b = 'e'; *c = 'm'; break; + case 235: *a = 'l'; *b = 'u'; *c = 'x'; break; + case 236: *a = 'f'; *b = 'e'; *c = 'd'; break; + case 237: *a = 's'; *b = 'e'; *c = 'd'; break; + case 238: *a = 'b'; *b = 'e'; *c = 'c'; break; + case 239: *a = 'm'; *b = 'u'; *c = 'n'; break; + case 240: *a = 'l'; *b = 'y'; *c = 'r'; break; + case 241: *a = 't'; *b = 'e'; *c = 's'; break; + case 242: *a = 'm'; *b = 'u'; *c = 'd'; break; + case 243: *a = 'n'; *b = 'y'; *c = 't'; break; + case 244: *a = 'b'; *b = 'y'; *c = 'r'; break; + case 245: *a = 's'; *b = 'e'; *c = 'n'; break; + case 246: *a = 'w'; *b = 'e'; *c = 'g'; break; + case 247: *a = 'f'; *b = 'y'; *c = 'r'; break; + case 248: *a = 'm'; *b = 'u'; *c = 'r'; break; + case 249: *a = 't'; *b = 'e'; *c = 'l'; break; + case 250: *a = 'r'; *b = 'e'; *c = 'p'; break; + case 251: *a = 't'; *b = 'e'; *c = 'g'; break; + case 252: *a = 'p'; *b = 'e'; *c = 'c'; break; + case 253: *a = 'n'; *b = 'e'; *c = 'l'; break; + case 254: *a = 'n'; *b = 'e'; *c = 'v'; break; + case 255: *a = 'f'; *b = 'e'; *c = 's'; break; + default: u3m_bail(c3__exit); + } +} + +u3_noun +u3qc_po_ins(u3_noun a) +{ + c3_y byt_y[3]; + u3r_bytes(0, 3, byt_y, a); + + return u3_po_find_prefix(byt_y[0], byt_y[1], byt_y[2]); +} + +u3_noun +u3wcp_ins(u3_noun cor) +{ + u3_noun a; + u3x_mean(cor, u3x_sam, &a, 0); + + if ( c3n == u3ud(a) ) { + return u3m_bail(c3__fail); + } + + return u3qc_po_ins(a); +} + +u3_noun +u3qc_po_ind(u3_noun a) +{ + c3_y byt_y[3]; + u3r_bytes(0, 3, byt_y, a); + + return u3_po_find_suffix(byt_y[0], byt_y[1], byt_y[2]); +} + +u3_noun +u3wcp_ind(u3_noun cor) +{ + u3_noun a; + u3x_mean(cor, u3x_sam, &a, 0); + + if ( c3n == u3ud(a) ) { + return u3m_bail(c3__fail); + } + + return u3qc_po_ind(a); +} + +u3_noun +u3wcp_tos(u3_noun cor) +{ + u3_noun a; + + if ( (c3n == u3r_mean(cor, u3x_sam, &a, 0)) || + (c3n == u3ud(a)) || + (a >= 256) ) + { + return u3m_bail(c3__exit); + } + else { + c3_y byt_y[3]; + u3_po_to_prefix(a, &byt_y[0], &byt_y[1], &byt_y[2]); + return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); + } +} + +u3_noun +u3wcp_tod(u3_noun cor) +{ + u3_noun a; + + if ( (c3n == u3r_mean(cor, u3x_sam, &a, 0)) || + (c3n == u3ud(a)) || + (a >= 256) ) + { + return u3m_bail(c3__exit); + } else { + c3_y byt_y[3]; + u3_po_to_suffix(a, &byt_y[0], &byt_y[1], &byt_y[2]); + return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); + } +} diff --git a/vere/pkg/noun/jets/c/pow.c b/vere/pkg/noun/jets/c/pow.c new file mode 100644 index 0000000..8d45fc8 --- /dev/null +++ b/vere/pkg/noun/jets/c/pow.c @@ -0,0 +1,38 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_pow(u3_atom a, + u3_atom b) + { + if ( !_(u3a_is_cat(b)) ) { + return u3m_bail(c3__fail); + } + else { + mpz_t a_mp; + + u3r_mp(a_mp, a); + mpz_pow_ui(a_mp, a_mp, b); + + return u3i_mp(a_mp); + } + } + u3_noun + u3wc_pow(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_pow(a, b); + } + } + diff --git a/vere/pkg/noun/jets/c/rap.c b/vere/pkg/noun/jets/c/rap.c new file mode 100644 index 0000000..4c95693 --- /dev/null +++ b/vere/pkg/noun/jets/c/rap.c @@ -0,0 +1,88 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_rap(u3_atom a, + u3_noun b) + { + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else { + c3_g a_g = a; + c3_w tot_w = 0; + u3i_slab sab_u; + + /* Measure and validate the slab required. + */ + { + u3_noun cab = b; + + while ( 1 ) { + u3_noun h_cab; + c3_w len_w; + + if ( 0 == cab ) { + break; + } + else if ( c3n == u3du(cab) ) { + return u3m_bail(c3__exit); + } + else if ( c3n == u3ud(h_cab = u3h(cab)) ) { + return u3m_bail(c3__exit); + } + else if ( (tot_w + (len_w = u3r_met(a_g, h_cab))) < tot_w ) { + return u3m_bail(c3__fail); + } + tot_w += len_w; + cab = u3t(cab); + } + + if ( 0 == tot_w ) { + return 0; + } + + u3i_slab_init(&sab_u, a_g, tot_w); + } + + /* Chop the list atoms in. + */ + { + u3_noun cab = b; + c3_w pos_w = 0; + + while ( 0 != cab ) { + u3_noun h_cab = u3h(cab); + c3_w len_w = u3r_met(a_g, h_cab); + + u3r_chop(a_g, 0, len_w, pos_w, sab_u.buf_w, h_cab); + pos_w += len_w; + cab = u3t(cab); + } + } + + return u3i_slab_mint(&sab_u); + } + } + u3_noun + u3wc_rap(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun pro; + + pro = u3qc_rap(a, b); + return pro; + } + } + diff --git a/vere/pkg/noun/jets/c/rep.c b/vere/pkg/noun/jets/c/rep.c new file mode 100644 index 0000000..914e917 --- /dev/null +++ b/vere/pkg/noun/jets/c/rep.c @@ -0,0 +1,199 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* + Get the lowest `n` bits of a word `w` using a bitmask. +*/ +#define TAKEBITS(n,w) \ + ((n)==32) ? (w) : \ + ((n)==0) ? 0 : \ + ((w) & ((1 << (n)) - 1)) + +/* + Divide, rounding up. +*/ +#define DIVCEIL(x,y) \ + (x==0) ? 0 : \ + 1 + ((x - 1) / y); + +static u3_noun +_bit_rep(u3_atom bits, u3_noun blox) +{ + if ( (c3n == u3a_is_cat(bits) || bits==0 || bits>31) ) { + return u3m_bail(c3__fail); + } + + // + // Calculate input and output size. + // + c3_w num_blox_w = u3qb_lent(blox); + c3_w bit_widt_w = num_blox_w * bits; + c3_w wor_widt_w = DIVCEIL(bit_widt_w, 32); + u3i_slab sab_u; + u3i_slab_bare(&sab_u, 5, wor_widt_w); + + // + // Fill the atom buffer with bits from each block. + // + // Bits are pushed into the `acc_w` register and flushed to the buffer + // once full. + // + // acc_w register + // use_w number of register bits filled (used) + // cur_w next buffer word to flush into. + // + { + c3_w acc_w=0, use_w=0, *cur_w=sab_u.buf_w; + +# define FLUSH() *cur_w++=acc_w; acc_w=use_w=0 +# define SLICE(sz,off,val) TAKEBITS(sz, val) << off + + for (c3_w i=0; i<num_blox_w; i++) { + u3_noun blok_n = u3h(blox); + blox = u3t(blox); + + if ( c3n == u3a_is_cat(blok_n) ) { + return u3m_bail(c3__fail); + } + + c3_w blok_w = blok_n; + + for (c3_w rem_in_blok_w=bits; rem_in_blok_w;) { + c3_w rem_in_acc_w = 32 - use_w; + if (rem_in_blok_w == rem_in_acc_w) { // EQ + acc_w |= SLICE(rem_in_blok_w, use_w, blok_w); + FLUSH(); + rem_in_blok_w = 0; + } + else if (rem_in_blok_w < rem_in_acc_w) { // LT + acc_w |= SLICE(rem_in_blok_w, use_w, blok_w); + use_w += rem_in_blok_w; + rem_in_blok_w = 0; + } + else { // GT + acc_w |= SLICE(rem_in_acc_w, use_w, blok_w); + rem_in_blok_w -= rem_in_acc_w; + blok_w = blok_w >> rem_in_acc_w; + FLUSH(); + } + } + } + + // + // If the last word isn't fully used, it will still need to be + // flushed. + // + if (use_w) { + FLUSH(); + } + } + + return u3i_slab_mint(&sab_u); +} + +static u3_noun +_block_rep(u3_atom a, + u3_noun b) +{ + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else { + c3_g a_g = a; + c3_w tot_w = 0; + u3i_slab sab_u; + + /* Measure and validate the slab required. + */ + { + u3_noun cab = b; + + while ( 1 ) { + u3_noun h_cab; + c3_w len_w; + + if ( 0 == cab ) { + break; + } + else if ( c3n == u3du(cab) ) { + return u3m_bail(c3__exit); + } + else if ( c3n == u3ud(h_cab = u3h(cab)) ) { + return u3m_bail(c3__exit); + } + else if ( (tot_w + (len_w = u3r_met(a_g, h_cab))) < tot_w ) { + return u3m_bail(c3__fail); + } + tot_w++; + cab = u3t(cab); + } + + if ( 0 == tot_w ) { + return 0; + } + + u3i_slab_init(&sab_u, a_g, tot_w); + } + + /* Chop the list atoms in. + */ + { + u3_noun cab = b; + c3_w pos_w = 0; + + while ( 0 != cab ) { + u3_noun h_cab = u3h(cab); + + u3r_chop(a_g, 0, 1, pos_w, sab_u.buf_w, h_cab); + pos_w++; + cab = u3t(cab); + } + } + + return u3i_slab_mint(&sab_u); + } +} + +u3_noun +u3qc_rep(u3_atom a, + u3_atom b, + u3_noun c) +{ + if ( 1 == b ) { + return _block_rep(a, c); + } + + if ( 0 == a ) { + return _bit_rep(b, c); + } + + u3l_log("rep: stub"); + return u3_none; +} + +u3_noun +u3wc_rep(u3_noun cor) +{ + u3_atom bloq, step; + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0); + u3x_bite(a, &bloq, &step); + + return u3qc_rep(bloq, step, b); +} + +u3_noun +u3kc_rep(u3_atom a, + u3_atom b, + u3_noun c) +{ + u3_noun res = u3qc_rep(a, b, c); + u3z(a); u3z(b); u3z(c); + return res; +} diff --git a/vere/pkg/noun/jets/c/rev.c b/vere/pkg/noun/jets/c/rev.c new file mode 100644 index 0000000..1ce74c0 --- /dev/null +++ b/vere/pkg/noun/jets/c/rev.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_rev(u3_atom boz, + u3_atom len, + u3_atom dat) + { + if ( !_(u3a_is_cat(boz)) || (boz >= 32) || + !_(u3a_is_cat(len)) ) { + return u3m_bail(c3__fail); + } + + dat = u3qc_end(boz, len, dat); + c3_w met = u3r_met(boz, dat); + return u3kc_lsh(boz, (len - met), u3kc_swp(boz, dat)); + } + + u3_noun + u3wc_rev(u3_noun cor) + { + u3_noun boz, len, dat; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &boz, + u3x_sam_6, &len, + u3x_sam_7, &dat, 0)) || + (c3n == u3ud(boz)) || + (c3n == u3ud(len)) || + (c3n == u3ud(dat)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_rev(boz, len, dat); + } + } + + u3_noun + u3kc_rev(u3_atom boz, + u3_atom len, + u3_atom dat) + { + u3_noun res = u3qc_rev(boz, len, dat); + u3z(boz); u3z(len); u3z(dat); + return res; + } diff --git a/vere/pkg/noun/jets/c/rig.c b/vere/pkg/noun/jets/c/rig.c new file mode 100644 index 0000000..7e5e7b9 --- /dev/null +++ b/vere/pkg/noun/jets/c/rig.c @@ -0,0 +1,82 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +c3_d +u3qc_rig_s(c3_g foq_g, + c3_w sep_w, + c3_g toq_g) +{ + c3_d sep_d = sep_w; + + if ( foq_g >= toq_g ) { + return sep_d << (foq_g - toq_g); + } + else { + c3_g dif_g = toq_g - foq_g; + + sep_d += (1 << dif_g) - 1; + return sep_d >> dif_g; + } +} + +u3_noun +u3qc_rig(u3_atom foq, + u3_atom sep, + u3_atom toq) +{ + if ( c3y == u3r_sing(foq, toq) ) { + return u3k(sep); + } + + if ( (c3y == u3a_is_cat(foq)) && (foq < 32) + && (c3y == u3a_is_cat(toq)) && (toq < 32) + && (c3y == u3a_is_cat(sep)) ) + { + c3_d sep_d = u3qc_rig_s((c3_g)foq, (c3_w)sep, (c3_g)toq); + return u3i_chub(sep_d); + } + + if ( c3y == u3qa_gth(foq, toq) ) { + u3_atom d = u3qa_sub(foq, toq); + u3_atom e = u3qc_lsh(0, d, sep); + u3z(d); + return e; + } + else { + u3_atom d = u3qa_sub(toq, foq); + u3_atom e = u3qc_rsh(0, d, sep); + u3_atom f = u3qc_end(0, d, sep); + + if ( f ) { + e = u3i_vint(e); + u3z(f); + } + + u3z(d); + return e; + } +} + +u3_noun +u3wc_rig(u3_noun cor) +{ + u3_atom boq, sep, vat; + { + u3_noun sam = u3h(u3t(cor)); + u3_noun bit = u3h(sam); + + if ( c3y == u3a_is_atom(bit) ) { + return 0; + } + + boq = u3x_atom(u3h(bit)); + sep = u3x_atom(u3t(bit)); + vat = u3x_atom(u3t(sam)); + } + + return u3qc_rig(boq, sep, vat); +} diff --git a/vere/pkg/noun/jets/c/rip.c b/vere/pkg/noun/jets/c/rip.c new file mode 100644 index 0000000..bff23b8 --- /dev/null +++ b/vere/pkg/noun/jets/c/rip.c @@ -0,0 +1,192 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* + Get the lowest `n` bits of a word `w` using a bitmask. +*/ +#define TAKEBITS(n,w) \ + ((n)==32) ? (w) : \ + ((n)==0) ? 0 : \ + ((w) & ((1 << (n)) - 1)) + +/* + Divide, rounding up. +*/ +#define DIVCEIL(x,y) \ + (x==0) ? 0 : \ + 1 + ((x - 1) / y); + +/* + `ripn` breaks `atom` into a list of blocks, of bit-width `bits`. The + resulting list will be least-significant block first. + + XX TODO This only handles cases where the bit-width is <= 32. + + For each block we produce, we need to grab the relevant words inside + `atom`, so we first compute their indicies. + + `ins_idx` is the word-index of the least-significant word we + care about, and `sig_idx` is the word after that. + + Next we grab those words (`ins_word` and `sig_word`) from the atom + using `u3r_word`. Note that `sig_idx` might be out-of-bounds for the + underlying array of `atom`, but `u3r_word` returns 0 in that case, + which is exatly what we want. + + Now, we need to grab the relevant bits out of both words, and combine + them. `bits_rem_in_ins_word` is the number of remaining (insignificant) + bits in `ins_word`, `nbits_ins` is the number of bits we want from the + less-significant word, and `nbits_sig` from the more-significant one. + + Take the least significant `nbits_sig` bits from `sig_word`, and take + the slice we care about from `ins_word`. In order to take that slice, + we drop `bits_rem_in_ins_word` insignificant bits, and then take the + `nbits_sig` most-significant bits. + + Last, we slice out those bits from the two words, combine them into + one word, and cons them onto the front of the result. +*/ +static u3_noun +_bit_rip(u3_atom bits, u3_atom atom) +{ + if ( !_(u3a_is_cat(bits) || bits==0 || bits>31) ) { + return u3m_bail(c3__fail); + } + + c3_w bit_width = u3r_met(0, atom); + c3_w num_blocks = DIVCEIL(bit_width, bits); + + u3_noun res = u3_nul; + + for ( c3_w blk = 0; blk < num_blocks; blk++ ) { + c3_w next_blk = blk + 1; + c3_w blks_rem = num_blocks - next_blk; + c3_w bits_rem = blks_rem * bits; + c3_w ins_idx = bits_rem / 32; + c3_w sig_idx = ins_idx + 1; + + c3_w bits_rem_in_ins_word = bits_rem % 32; + + c3_w ins_word = u3r_word(ins_idx, atom); + c3_w sig_word = u3r_word(sig_idx, atom); + c3_w nbits_ins = c3_min(bits, 32 - bits_rem_in_ins_word); + c3_w nbits_sig = bits - nbits_ins; + + c3_w ins_word_bits = TAKEBITS(nbits_ins, ins_word >> bits_rem_in_ins_word); + c3_w sig_word_bits = TAKEBITS(nbits_sig, sig_word); + + c3_w item = ins_word_bits | (sig_word_bits << nbits_ins); + + res = u3nc(item, res); + } + + return res; +} + +static u3_noun +_block_rip(u3_atom bloq, u3_atom b) +{ + if ( !_(u3a_is_cat(bloq)) || (bloq >= 32) ) { + return u3m_bail(c3__fail); + } + + c3_g bloq_g = bloq; + + /* + This is a fast-path for the case where all the resulting blocks will + fit in 31-bit direct atoms. + */ + if ( bloq_g < 5 ) { // produce direct atoms + u3_noun acc = u3_nul; + + c3_w met_w = u3r_met(bloq_g, b); // num blocks in atom + c3_w nbits_w = 1 << bloq_g; // block size in bits + c3_w bmask_w = (1 << nbits_w) - 1; // result mask + + for ( c3_w i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index + c3_w nex_w = i_w + 1; // next block + c3_w pat_w = met_w - nex_w; // blks left after this + c3_w bit_w = pat_w << bloq_g; // bits left after this + c3_w wor_w = bit_w >> 5; // wrds left after this + c3_w sif_w = bit_w & 31; // bits left in word + c3_w src_w = u3r_word(wor_w, b); // find word by index + c3_w rip_w = (src_w >> sif_w) & bmask_w; // get item from word + + acc = u3nc(rip_w, acc); + } + + return acc; + } + + u3_noun acc = u3_nul; + c3_w met_w = u3r_met(bloq_g, b); + c3_w len_w = u3r_met(5, b); + c3_g san_g = (bloq_g - 5); + c3_w san_w = 1 << san_g; + c3_w dif_w = (met_w << san_g) - len_w; + c3_w tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w)); + + for ( c3_w i_w = 0; i_w < met_w; i_w++ ) { + c3_w pat_w = (met_w - (i_w + 1)); + c3_w wut_w = (pat_w << san_g); + c3_w sap_w = ((0 == i_w) ? tub_w : san_w); + c3_w j_w; + u3_atom rip; + u3i_slab sab_u; + u3i_slab_bare(&sab_u, 5, sap_w); + + for ( j_w = 0; j_w < sap_w; j_w++ ) { + sab_u.buf_w[j_w] = u3r_word(wut_w + j_w, b); + } + + rip = u3i_slab_mint(&sab_u); + acc = u3nc(rip, acc); + len_w -= san_w; + } + + return acc; +} + +u3_noun +u3qc_rip(u3_atom a, + u3_atom b, + u3_atom c) +{ + if ( 1 == b ) { + return _block_rip(a, c); + } + + if ( 0 == a ) { + return _bit_rip(b, c); + } + + u3l_log("rip: stub"); + return u3_none; +} + +u3_noun +u3wc_rip(u3_noun cor) +{ + u3_atom bloq, step; + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0); + u3x_bite(a, &bloq, &step); + + return u3qc_rip(bloq, step, u3x_atom(b)); +} + +u3_noun +u3kc_rip(u3_atom a, + u3_atom b, + u3_atom c) +{ + u3_noun pro = u3qc_rip(a, b, c); + u3z(a); u3z(b); u3z(c); + return pro; +} diff --git a/vere/pkg/noun/jets/c/rsh.c b/vere/pkg/noun/jets/c/rsh.c new file mode 100644 index 0000000..6fc8ddf --- /dev/null +++ b/vere/pkg/noun/jets/c/rsh.c @@ -0,0 +1,60 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_rsh(u3_atom a, + u3_atom b, + u3_atom c) +{ + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + else if ( !_(u3a_is_cat(b)) ) { + return 0; + } + else { + c3_g a_g = a; + c3_w b_w = b; + c3_w len_w = u3r_met(a_g, c); + + if ( b_w >= len_w ) { + return 0; + } + else { + u3i_slab sab_u; + u3i_slab_init(&sab_u, a_g, (len_w - b_w)); + + u3r_chop(a_g, b_w, (len_w - b_w), 0, sab_u.buf_w, c); + + return u3i_slab_mint(&sab_u); + } + } +} + +u3_noun +u3wc_rsh(u3_noun cor) +{ + u3_atom bloq, step; + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0); + u3x_bite(a, &bloq, &step); + + return u3qc_rsh(bloq, step, u3x_atom(b)); +} + +u3_noun +u3kc_rsh(u3_noun a, + u3_noun b, + u3_noun c) +{ + u3_noun d = u3qc_rsh(a, b, c); + + u3z(a); u3z(b); u3z(c); + return d; +} diff --git a/vere/pkg/noun/jets/c/sew.c b/vere/pkg/noun/jets/c/sew.c new file mode 100644 index 0000000..02359f7 --- /dev/null +++ b/vere/pkg/noun/jets/c/sew.c @@ -0,0 +1,74 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_weak +u3qc_sew(u3_atom a, + u3_atom b, + u3_atom c, + u3_atom d, + u3_atom e + ) +{ + c3_w b_w, c_w; + if (0 == c) return u3k(e); + if ( !_(u3r_safe_word(b, &b_w)) || + !_(u3r_safe_word(c, &c_w)) ) { + return u3_none; + } + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + + c3_g a_g = a; + c3_w len_e_w = u3r_met(a_g, e); + u3i_slab sab_u; + c3_w* src_w; + c3_w len_src_w; + if ( _(u3a_is_cat(e)) ) { + len_src_w = e ? 1 : 0; + src_w = &e; + } + else { + u3a_atom* src_u = u3a_to_ptr(e); + len_src_w = src_u->len_w; + src_w = src_u->buf_w; + } + u3i_slab_init(&sab_u, a_g, c3_max(len_e_w, b_w + c_w)); + u3r_chop_words(a_g, 0, b_w, 0, sab_u.buf_w, len_src_w, src_w); + u3r_chop(a_g, 0, c_w, b_w, sab_u.buf_w, d); + if (len_e_w > b_w + c_w) { + u3r_chop_words(a_g, + b_w + c_w, + len_e_w - (b_w + c_w), + b_w + c_w, + sab_u.buf_w, + len_src_w, + src_w); + } + return u3i_slab_mint(&sab_u); +} + +u3_weak +u3wc_sew(u3_noun cor) +{ + u3_noun a, b, c, d, e; + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_12, &b, + 106, &c, + 107, &d, + u3x_sam_7, &e, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) || + (c3n == u3ud(d)) || + (c3n == u3ud(e)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qc_sew(a, b, c, d, e); + } +} diff --git a/vere/pkg/noun/jets/c/sqt.c b/vere/pkg/noun/jets/c/sqt.c new file mode 100644 index 0000000..b20db59 --- /dev/null +++ b/vere/pkg/noun/jets/c/sqt.c @@ -0,0 +1,33 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_sqt(u3_atom a) + { + mpz_t a_mp, b_mp; + + u3r_mp(a_mp, a); + mpz_init(b_mp); + mpz_sqrtrem(a_mp, b_mp, a_mp); + + return u3nc(u3i_mp(a_mp), u3i_mp(b_mp)); + } + u3_noun + u3wc_sqt(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_sqt(a); + } + } + diff --git a/vere/pkg/noun/jets/c/swp.c b/vere/pkg/noun/jets/c/swp.c new file mode 100644 index 0000000..4f503e7 --- /dev/null +++ b/vere/pkg/noun/jets/c/swp.c @@ -0,0 +1,50 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_swp(u3_atom a, + u3_atom b) +{ + if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + return u3m_bail(c3__fail); + } + c3_g a_g = a; + c3_w len_w = u3r_met(a_g, b); + u3i_slab sab_u; + u3i_slab_init(&sab_u, a_g, len_w); + + for (c3_w i = 0; i < len_w; i++) { + u3r_chop(a_g, i, 1, len_w - i - 1, sab_u.buf_w, b); + } + + return u3i_slab_mint(&sab_u); +} + +u3_noun +u3wc_swp(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + + if ( (c3n == u3ud(a)) + || (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } + + return u3qc_swp(a, b); + } + +u3_noun +u3kc_swp(u3_atom a, + u3_atom b) +{ + u3_noun pro = u3qc_swp(a, b); + u3z(a); u3z(b); + return pro; +} diff --git a/vere/pkg/noun/jets/c/xeb.c b/vere/pkg/noun/jets/c/xeb.c new file mode 100644 index 0000000..6a23ac1 --- /dev/null +++ b/vere/pkg/noun/jets/c/xeb.c @@ -0,0 +1,32 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qc_xeb(u3_atom a) + { + c3_w met_w = u3r_met(0, a); + + if ( !_(u3a_is_cat(met_w)) ) { + return u3i_words(1, &met_w); + } + else return met_w; + } + u3_noun + u3wc_xeb(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qc_xeb(a); + } + } + diff --git a/vere/pkg/noun/jets/d/by_all.c b/vere/pkg/noun/jets/d/by_all.c new file mode 100644 index 0000000..25926a7 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_all.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_by_all(u3_noun a, u3j_site* sit_u) +{ + if ( u3_nul == a ) { + return c3y; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + switch ( u3j_gate_slam(sit_u, u3k(u3t(n_a))) ) { + case c3y: break; + case c3n: return c3n; + default: return u3m_bail(c3__exit); + } + + if ( c3n == _by_all(l_a, sit_u) ) { + return c3n; + } + + return _by_all(r_a, sit_u); + } +} + +u3_noun +u3qdb_all(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + pro = _by_all(a, &sit_u); + u3j_gate_lose(&sit_u); + + return pro; +} + +u3_noun +u3wdb_all(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_all(a, b); +} diff --git a/vere/pkg/noun/jets/d/by_any.c b/vere/pkg/noun/jets/d/by_any.c new file mode 100644 index 0000000..b81f32d --- /dev/null +++ b/vere/pkg/noun/jets/d/by_any.c @@ -0,0 +1,51 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_by_any(u3_noun a, u3j_site* sit_u) +{ + if ( u3_nul == a ) { + return c3n; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + switch ( u3j_gate_slam(sit_u, u3k(u3t(n_a))) ) { + case c3y: return c3y; + case c3n: break; + default: return u3m_bail(c3__exit); + } + + if ( c3y == _by_any(l_a, sit_u) ) { + return c3y; + } + + return _by_any(r_a, sit_u); + } +} + +u3_noun +u3qdb_any(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + pro = _by_any(a, &sit_u); + u3j_gate_lose(&sit_u); + + return pro; +} + +u3_noun +u3wdb_any(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_any(a, b); +} diff --git a/vere/pkg/noun/jets/d/by_apt.c b/vere/pkg/noun/jets/d/by_apt.c new file mode 100644 index 0000000..66a6414 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_apt.c @@ -0,0 +1,78 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static c3_o +_by_apt(u3_noun a, u3_weak l, u3_weak r) +{ + if ( u3_nul == a ) { + return c3y; + } + else { + u3_noun p_n_a, l_a, r_a; + { + u3_noun n_a; + u3x_trel(a, &n_a, &l_a, &r_a); + p_n_a = u3h(n_a); + } + + if ( u3_none != l ) { + if ( (c3n == u3qc_gor(p_n_a, l)) + || (c3y == u3r_sing(p_n_a, l)) ) + { + return c3n; + } + } + + if ( u3_none != r ) { + if ( (c3n == u3qc_gor(r, p_n_a)) + || (c3y == u3r_sing(r, p_n_a)) ) + { + return c3n; + } + } + + if ( u3_nul != l_a ) { + u3_noun p_n_l_a = u3h(u3h(l_a)); + + if ( (c3n == u3qc_mor(p_n_a, p_n_l_a)) + || (c3y == u3r_sing(p_n_a, p_n_l_a)) ) + { + return c3n; + } + + if ( c3n == _by_apt(l_a, p_n_a, r) ) { + return c3n; + } + } + + if ( u3_nul != r_a ) { + u3_noun p_n_r_a = u3h(u3h(r_a)); + + if ( (c3n == u3qc_mor(p_n_a, p_n_r_a)) + || (c3y == u3r_sing(p_n_a, p_n_r_a)) ) + { + return c3n; + } + + return _by_apt(r_a, l, p_n_a); + } + + return c3y; + } +} + +u3_noun +u3qdb_apt(u3_noun a) +{ + return _by_apt(a, u3_none, u3_none); +} + +u3_noun +u3wdb_apt(u3_noun cor) +{ + return u3qdb_apt(u3x_at(u3x_con_sam, cor)); +} diff --git a/vere/pkg/noun/jets/d/by_bif.c b/vere/pkg/noun/jets/d/by_bif.c new file mode 100644 index 0000000..0a2f23a --- /dev/null +++ b/vere/pkg/noun/jets/d/by_bif.c @@ -0,0 +1,74 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* internal functions +*/ +static u3_noun +_b_bif_putroot(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return u3nt(u3k(b), u3_nul, u3_nul); + } + else { + u3_noun n_a, l_a, r_a; + u3_noun p_n_a, q_n_a; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_cell(n_a, &p_n_a, &q_n_a); + + if ( c3y == u3r_sing(b, p_n_a) ) { + return u3nt(u3k(b), u3k(l_a), u3k(r_a)); + } + else { + u3_noun c, n_c, l_c, r_c; + u3_noun d; + + if ( c3y == u3qc_gor(b, p_n_a) ) { + c = _b_bif_putroot(l_a, b); + u3r_trel(c, &n_c, &l_c, &r_c); + d = u3nt(u3k(n_c), + u3k(l_c), + u3nt(u3k(n_a), u3k(r_c), u3k(r_a)) + ); + u3z(c); + return d; + } + else { + c = _b_bif_putroot(r_a, b); + u3r_trel(c, &n_c, &l_c, &r_c); + d = u3nt(u3k(n_c), + u3nt(u3k(n_a), u3k(l_a), u3k(l_c)), + u3k(r_c) + ); + u3z(c); + return d; + } + } + } +} + +u3_noun +u3wdb_bif(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_bif(a, b); +} + +u3_noun +u3qdb_bif(u3_noun a, + u3_noun b) +{ + u3_noun c, n_c, l_c, r_c; + u3_noun d; + + c = _b_bif_putroot(a, b); + u3r_trel(c, &n_c, &l_c, &r_c); + d = u3nc(u3k(l_c), u3k(r_c)); + u3z(c); + return d; +} diff --git a/vere/pkg/noun/jets/d/by_del.c b/vere/pkg/noun/jets/d/by_del.c new file mode 100644 index 0000000..86ba416 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_del.c @@ -0,0 +1,93 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_rebalance(u3_noun a) +{ + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + if ( u3_nul == l_a) { + return u3k(r_a); + } + else if ( u3_nul == r_a) { + return u3k(l_a); + } + else { + u3_noun n_l_a, l_l_a, r_l_a; + u3_noun n_r_a, l_r_a, r_r_a; + u3x_trel(l_a, &n_l_a, &l_l_a, &r_l_a); + u3x_trel(r_a, &n_r_a, &l_r_a, &r_r_a); + + if ( c3y == u3qc_mor(u3h(n_l_a), u3h(n_r_a)) ) { + u3_noun new_right = u3nt(u3k(n_a), + u3k(r_l_a), + u3k(r_a)); + + u3_noun ret = u3nt(u3k(n_l_a), + u3k(l_l_a), + _rebalance(new_right)); + u3z(new_right); + + return ret; + } + else { + u3_noun new_left = u3nt(u3k(n_a), + u3k(l_a), + u3k(l_r_a)); + + u3_noun ret = u3nt(u3k(n_r_a), + _rebalance(new_left), + u3k(r_r_a)); + u3z(new_left); + + return ret; + } + } +} + +u3_noun +u3qdb_del(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return u3_nul; + } + else { + u3_noun n_a, lr_a; + u3_noun pn_a; + u3x_cell(a, &n_a, &lr_a); + u3x_cell(n_a, &pn_a, 0); + + if ( c3y == u3r_sing(pn_a, b) ) { + return _rebalance(a); + } + else { + u3_noun l_a, r_a; + u3x_cell(lr_a, &l_a, &r_a); + + if ( c3y == u3qc_gor(b, pn_a) ) { + return u3nt(u3k(n_a), + u3qdb_del(l_a, b), + u3k(r_a)); + } + else { + return u3nt(u3k(n_a), + u3k(l_a), + u3qdb_del(r_a, b)); + } + } + } +} + +u3_noun +u3wdb_del(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_del(a, b); +} diff --git a/vere/pkg/noun/jets/d/by_dif.c b/vere/pkg/noun/jets/d/by_dif.c new file mode 100644 index 0000000..44dcd1a --- /dev/null +++ b/vere/pkg/noun/jets/d/by_dif.c @@ -0,0 +1,83 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* internal functions +*/ + +/* RETAIN +*/ +static u3_noun +_b_dif_join(u3_noun d, + u3_noun e) +{ + if ( u3_nul == d ) { + return u3k(e); + } + else if ( u3_nul == e ) { + return u3k(d); + } + else { + u3_noun n_d, lr_d; + u3_noun n_e, lr_e; + u3x_cell(d, &n_d, &lr_d); + u3x_cell(e, &n_e, &lr_e); + + if ( c3y == u3qc_mor(u3h(n_d), u3h(n_e)) ) { + u3_noun l_d, r_d; + u3x_cell(lr_d, &l_d, &r_d); + + return u3nt(u3k(n_d), + u3k(l_d), + _b_dif_join(r_d, e)); + } + else { + u3_noun l_e, r_e; + u3x_cell(lr_e, &l_e, &r_e); + + return u3nt(u3k(n_e), + _b_dif_join(d, l_e), + u3k(r_e)); + } + } +} + +u3_noun +u3wdb_dif(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_dif(a, b); +} + +u3_noun +u3qdb_dif(u3_noun a, + u3_noun b) +{ + if ( u3_nul == b ) { + return u3k(a); + } + else { + u3_noun n_b, p_n_b, q_n_b, l_b, r_b; + u3_noun c, l_c, r_c; + u3x_trel(b, &n_b, &l_b, &r_b); + u3x_cell(n_b, &p_n_b, &q_n_b); + + c = u3qdb_bif(a, p_n_b); + u3x_cell(c, &l_c, &r_c); + + u3_noun d = u3qdb_dif(l_c, l_b); + u3_noun e = u3qdb_dif(r_c, r_b); + + u3z(c); + + u3_noun pro = _b_dif_join(d, e); + u3z(d); + u3z(e); + + return pro; + } +} diff --git a/vere/pkg/noun/jets/d/by_gas.c b/vere/pkg/noun/jets/d/by_gas.c new file mode 100644 index 0000000..2da171d --- /dev/null +++ b/vere/pkg/noun/jets/d/by_gas.c @@ -0,0 +1,44 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdb_gas(u3_noun a, + u3_noun b) +{ + if ( u3_nul == b ) { + return u3k(a); + } + else { + u3_noun i_b, t_b, + pi_b, qi_b; + u3x_cell(b, &i_b, &t_b); + u3x_cell(i_b, &pi_b, &qi_b); + + u3_noun c = u3qdb_put(a, pi_b, qi_b); + u3_noun d = u3qdb_gas(c, t_b); + u3z(c); + return d; + } +} + +u3_noun +u3wdb_gas(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_gas(a, b); +} + +u3_noun +u3kdb_gas(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qdb_gas(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/d/by_get.c b/vere/pkg/noun/jets/d/by_get.c new file mode 100644 index 0000000..19e77b9 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_get.c @@ -0,0 +1,63 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdb_get(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return u3_nul; + } + else { + u3_noun n_a, lr_a; + u3_noun pn_a, qn_a; + u3x_cell(a, &n_a, &lr_a); + u3x_cell(n_a, &pn_a, &qn_a); + + if ( (c3y == u3r_sing(b, pn_a)) ) { + return u3nc(u3_nul, u3k(qn_a)); + } + else { + return ( c3y == u3qc_gor(b, pn_a) ) ? u3qdb_get(u3h(lr_a), b) + : u3qdb_get(u3t(lr_a), b); + } + } +} + +u3_noun +u3wdb_get(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_get(a, b); +} + +u3_weak +u3kdb_get(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qdb_get(a, b); + u3z(a); u3z(b); + + if ( c3n == u3du(c) ) { + u3z(c); + return u3_none; + } + else { + u3_noun pro = u3k(u3t(c)); + u3z(c); + return pro; + } +} + +u3_noun +u3kdb_got(u3_noun a, + u3_noun b) +{ + return u3x_good(u3kdb_get(a, b)); +} diff --git a/vere/pkg/noun/jets/d/by_has.c b/vere/pkg/noun/jets/d/by_has.c new file mode 100644 index 0000000..24bcb31 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_has.c @@ -0,0 +1,47 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdb_has(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return c3n; + } + else { + u3_noun n_a, lr_a; + u3_noun pn_a; + u3x_cell(a, &n_a, &lr_a); + u3x_cell(n_a, &pn_a, 0); + + if ( (c3y == u3r_sing(b, pn_a)) ) { + return c3y; + } + else { + return ( c3y == u3qc_gor(b, pn_a) ) ? u3qdb_has(u3h(lr_a), b) + : u3qdb_has(u3t(lr_a), b); + } + } +} + +u3_noun +u3wdb_has(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_has(a, b); +} + +u3_noun +u3kdb_has(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qdb_has(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/d/by_int.c b/vere/pkg/noun/jets/d/by_int.c new file mode 100644 index 0000000..5caa8aa --- /dev/null +++ b/vere/pkg/noun/jets/d/by_int.c @@ -0,0 +1,72 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdb_int(u3_noun a, u3_noun b) +{ + if ( (u3_nul == a) + || (u3_nul == b) ) + { + return u3_nul; + } + else { + u3_noun n_a, l_a, r_a; + u3_noun n_b, l_b, r_b; + u3_noun p_n_a, q_n_a; + u3_noun p_n_b, q_n_b; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_trel(b, &n_b, &l_b, &r_b); + u3x_cell(n_a, &p_n_a, &q_n_a); + u3x_cell(n_b, &p_n_b, &q_n_b); + + if ( c3y == u3qc_mor(p_n_a, p_n_b) ) { + if ( c3y == u3r_sing(p_n_b, p_n_a) ) { + return u3nt(u3k(n_b), u3qdb_int(l_a, l_b), u3qdb_int(r_a, r_b)); + } + else if ( c3y == u3qc_gor(p_n_b, p_n_a) ) { + u3_noun new_l_b = u3nt(u3k(n_b), u3k(l_b), u3_nul); + u3_noun new_a = u3qdb_int(l_a, new_l_b); + + u3z(new_l_b); + return u3kdb_uni(new_a, u3qdb_int(a, r_b)); + } + else { + u3_noun new_r_b = u3nt(u3k(n_b), u3_nul, u3k(r_b)); + u3_noun new_a = u3qdb_int(r_a, new_r_b); + + u3z(new_r_b); + return u3kdb_uni(new_a, u3qdb_int(a, l_b)); + } + } + else if ( c3y == u3r_sing(p_n_a, p_n_b) ) { + return u3nt(u3k(n_b), u3qdb_int(l_a, l_b), u3qdb_int(r_a, r_b)); + } + else if ( c3y == u3qc_gor(p_n_a, p_n_b) ) { + u3_noun new_l_a = u3nt(u3k(n_a), u3k(l_a), u3_nul); + u3_noun new_a = u3qdb_int(new_l_a, l_b); + + u3z(new_l_a); + return u3kdb_uni(new_a, u3qdb_int(r_a, b)); + } + else { + u3_noun new_r_a = u3nt(u3k(n_a), u3_nul, u3k(r_a)); + u3_noun new_a = u3qdb_int(new_r_a, r_b); + + u3z(new_r_a); + return u3kdb_uni(new_a, u3qdb_int(l_a, b)); + } + } +} + +u3_noun +u3wdb_int(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_int(a, b); +} diff --git a/vere/pkg/noun/jets/d/by_jab.c b/vere/pkg/noun/jets/d/by_jab.c new file mode 100644 index 0000000..597e454 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_jab.c @@ -0,0 +1,63 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3kdb_jab(u3_noun a, + u3_noun key, + u3_noun fun) + { + if ( u3_nul == a ) { + return u3m_bail(c3__exit); + } + else { + u3_noun n_a, lr_a; + u3_noun pn_a, qn_a; + u3_noun pro; + u3x_cell(a, &n_a, &lr_a); + u3x_cell(n_a, &pn_a, &qn_a); + + if ( (c3y == u3r_sing(key, pn_a)) ) { + u3_noun value = u3n_slam_on(fun, u3k(qn_a)); + pro = u3nc(u3nc(u3k(u3h(u3h(a))), value), u3k(u3t(a))); + u3z(a); u3z(key); + return pro; + } + else { + u3_noun l_a, r_a; + u3x_cell(lr_a, &l_a, &r_a); + + u3k(n_a); u3k(l_a); u3k(r_a); + if ( c3y == u3qc_gor(key, pn_a) ) { + pro = u3nt(n_a, u3kdb_jab(l_a, key, fun), r_a); + } + else { + pro = u3nt(n_a, l_a, u3kdb_jab(r_a, key, fun)); + } + u3z(a); + return pro; + } + } +} + +u3_noun +u3qdb_jab(u3_noun a, + u3_noun key, + u3_noun fun) +{ + return u3kdb_jab(u3k(a), u3k(key), u3k(fun)); +} + +u3_noun +u3wdb_jab(u3_noun cor) +{ + u3_noun a, key, fun; + u3x_mean(cor, u3x_sam_2, &key, + u3x_sam_3, &fun, + u3x_con_sam, &a, 0); + + return u3qdb_jab(a, key, fun); +} diff --git a/vere/pkg/noun/jets/d/by_key.c b/vere/pkg/noun/jets/d/by_key.c new file mode 100644 index 0000000..b4f8a09 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_key.c @@ -0,0 +1,42 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +// [a] is RETAINED, [set] is TRANSFERRED +// +static u3_noun +_by_key(u3_noun a, u3_noun set) +{ + if ( u3_nul == a ) { + return set; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + { + u3_noun new = u3qdi_put(set, u3h(n_a)); + u3z(set); + set = new; + } + + set = _by_key(l_a, set); + + return _by_key(r_a, set); + } +} + +u3_noun +u3qdb_key(u3_noun a) +{ + return _by_key(a, u3_nul); +} + +u3_noun +u3wdb_key(u3_noun cor) +{ + return u3qdb_key(u3x_at(u3x_con_sam, cor)); +} diff --git a/vere/pkg/noun/jets/d/by_put.c b/vere/pkg/noun/jets/d/by_put.c new file mode 100644 index 0000000..ad0e7ec --- /dev/null +++ b/vere/pkg/noun/jets/d/by_put.c @@ -0,0 +1,102 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdb_put(u3_noun a, + u3_noun b, + u3_noun c) +{ + if ( u3_nul == a ) { + return u3nt(u3nc(u3k(b), u3k(c)), + u3_nul, + u3_nul); + } + else { + u3_noun n_a, l_a, r_a; + u3_noun pn_a, qn_a; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_cell(n_a, &pn_a, &qn_a); + + if ( c3y == u3r_sing(pn_a, b) ) { + if ( c3y == u3r_sing(qn_a, c) ) { + return u3k(a); + } + else { + return u3nt(u3nc(u3k(b), u3k(c)), + u3k(l_a), + u3k(r_a)); + } + } + else { + u3_noun d, n_d, l_d, r_d; + + if ( c3y == u3qc_gor(b, pn_a) ) { + d = u3qdb_put(l_a, b, c); + + if ( c3y == u3qc_mor(pn_a, u3h(u3h(d))) ) { + return u3nt(u3k(n_a), + d, + u3k(r_a)); + } + else { + u3r_trel(d, &n_d, &l_d, &r_d); + + u3_noun e = u3nt(u3k(n_d), + u3k(l_d), + u3nt(u3k(n_a), + u3k(r_d), + u3k(r_a))); + + u3z(d); + return e; + } + } + else { + d = u3qdb_put(r_a, b, c); + + if ( c3y == u3qc_mor(pn_a, u3h(u3h(d))) ) { + return u3nt(u3k(n_a), + u3k(l_a), + d); + } + else { + u3r_trel(d, &n_d, &l_d, &r_d); + + u3_noun e = u3nt(u3k(n_d), + u3nt(u3k(n_a), + u3k(l_a), + u3k(l_d)), + u3k(r_d)); + + u3z(d); + return e; + } + } + } + } +} + +u3_noun +u3wdb_put(u3_noun cor) +{ + u3_noun a, b, c; + u3x_mean(cor, u3x_sam_2, &b, + u3x_sam_3, &c, + u3x_con_sam, &a, 0); + return u3qdb_put(a, b, c); +} + +u3_noun +u3kdb_put(u3_noun a, + u3_noun b, + u3_noun c) +{ + u3_noun pro = u3qdb_put(a, b, c); + u3z(a); u3z(b); u3z(c); + return pro; +} diff --git a/vere/pkg/noun/jets/d/by_run.c b/vere/pkg/noun/jets/d/by_run.c new file mode 100644 index 0000000..491a32c --- /dev/null +++ b/vere/pkg/noun/jets/d/by_run.c @@ -0,0 +1,53 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_by_run(u3_noun a, u3j_site* sit_u) +{ + if ( u3_nul == a ) { + return u3_nul; + } + else { + u3_noun n_a, l_a, r_a; + u3_noun p_n_a, q_n_a; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_cell(n_a, &p_n_a, &q_n_a); + + u3k(p_n_a); + u3k(q_n_a); + u3k(l_a); + u3k(r_a); + + u3_noun pro = u3nt(u3nc(p_n_a, u3j_gate_slam(sit_u, q_n_a)), + _by_run(l_a, sit_u), + _by_run(r_a, sit_u)); + + u3z(a); + return pro; + } +} + +u3_noun +u3qdb_run(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + pro = _by_run(u3k(a), &sit_u); + u3j_gate_lose(&sit_u); + + return pro; +} + +u3_noun +u3wdb_run(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_run(a, b); +} diff --git a/vere/pkg/noun/jets/d/by_uni.c b/vere/pkg/noun/jets/d/by_uni.c new file mode 100644 index 0000000..6bdcd4c --- /dev/null +++ b/vere/pkg/noun/jets/d/by_uni.c @@ -0,0 +1,101 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +u3_noun +u3qdb_uni(u3_noun a, u3_noun b) +{ + if ( u3_nul == b ) { + return u3k(a); + } + else if ( u3_nul == a ) { + return u3k(b); + } + else { + u3_noun n_a, l_a, r_a; + u3_noun n_b, l_b, r_b; + u3_noun p_n_a, q_n_a; + u3_noun p_n_b, q_n_b; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_trel(b, &n_b, &l_b, &r_b); + u3x_cell(n_a, &p_n_a, &q_n_a); + u3x_cell(n_b, &p_n_b, &q_n_b); + + if ( c3y == u3r_sing(p_n_a, p_n_b) ) { + return u3nt(u3k(n_b), + u3qdb_uni(l_a, l_b), + u3qdb_uni(r_a, r_b)); + } + else if ( c3y == u3qc_mor(p_n_a, p_n_b) ) { + u3_noun new_a, old_b; + + if ( c3y == u3qc_gor(p_n_b, p_n_a) ) { + u3_noun new_b = u3nt(u3k(n_b), u3k(l_b), u3_nul); + u3_noun new_la = u3qdb_uni(l_a, new_b); + u3z(new_b); + + new_a = u3nt(u3k(n_a), new_la, u3k(r_a)); + old_b = r_b; + } + else { + u3_noun new_b = u3nt(u3k(n_b), u3_nul, u3k(r_b)); + u3_noun new_ra = u3qdb_uni(r_a, new_b); + u3z(new_b); + + new_a = u3nt(u3k(n_a), u3k(l_a), new_ra); + old_b = l_b; + } + + { + u3_noun pro = u3qdb_uni(new_a, old_b); + u3z(new_a); + return pro; + } + } + else { + u3_noun old_a, new_b; + + if ( c3y == u3qc_gor(p_n_a, p_n_b) ) { + u3_noun new_a = u3nt(u3k(n_a), u3k(l_a), u3_nul); + u3_noun new_lb = u3qdb_uni(new_a, l_b); + u3z(new_a); + + new_b = u3nt(u3k(n_b), new_lb, u3k(r_b)); + old_a = r_a; + } + else { + u3_noun new_a = u3nt(u3k(n_a), u3_nul, u3k(r_a)); + u3_noun new_rb = u3qdb_uni(new_a, r_b); + u3z(new_a); + + new_b = u3nt(u3k(n_b), u3k(l_b), new_rb); + old_a = l_a; + } + + { + u3_noun pro = u3qdb_uni(old_a, new_b); + u3z(new_b); + return pro; + } + } + } +} + +u3_noun +u3wdb_uni(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_uni(a, b); +} + +u3_noun +u3kdb_uni(u3_noun a, u3_noun b) +{ + u3_noun pro = u3qdb_uni(a, b); + u3z(a); u3z(b); + return pro; +} diff --git a/vere/pkg/noun/jets/d/by_urn.c b/vere/pkg/noun/jets/d/by_urn.c new file mode 100644 index 0000000..5c82876 --- /dev/null +++ b/vere/pkg/noun/jets/d/by_urn.c @@ -0,0 +1,52 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_by_urn(u3_noun a, u3j_site* sit_u) +{ + if ( u3_nul == a ) { + return u3_nul; + } + else { + u3_noun n_a, l_a, r_a, p_n_a; + u3x_trel(a, &n_a, &l_a, &r_a); + p_n_a = u3h(n_a); + + u3k(p_n_a); + u3k(n_a); + u3k(l_a); + u3k(r_a); + + u3_noun pro = u3nt(u3nc(p_n_a, u3j_gate_slam(sit_u, n_a)), + _by_urn(l_a, sit_u), + _by_urn(r_a, sit_u)); + + u3z(a); + return pro; + } +} + +u3_noun +u3qdb_urn(u3_noun a, u3_noun b) +{ + u3_noun pro; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + pro = _by_urn(u3k(a), &sit_u); + u3j_gate_lose(&sit_u); + + return pro; +} + +u3_noun +u3wdb_urn(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdb_urn(a, b); +} diff --git a/vere/pkg/noun/jets/d/in_apt.c b/vere/pkg/noun/jets/d/in_apt.c new file mode 100644 index 0000000..93e7b48 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_apt.c @@ -0,0 +1,121 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static c3_o +_in_apt_140(u3_noun a, u3_weak l, u3_weak r) +{ + if ( u3_nul == a ) { + return c3y; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + if ( (u3_none != l) && (c3n == u3qc_gor(n_a, l)) ) { + return c3n; + } + + if ( (u3_none != r) && (c3n == u3qc_gor(r, n_a)) ) { + return c3n; + } + + if ( u3_nul != l_a ) { + if ( c3n == u3qc_mor(n_a, u3h(l_a)) ) { + return c3n; + } + + if ( c3n == _in_apt_140(l_a, n_a, r) ) { + return c3n; + } + } + + if ( u3_nul != r_a ) { + if ( c3n == u3qc_mor(n_a, u3h(r_a)) ) { + return c3n; + } + + return _in_apt_140(r_a, l, n_a); + } + + return c3y; + } +} + +u3_noun +u3qdi_apt_140(u3_noun a) +{ + return _in_apt_140(a, u3_none, u3_none); +} + +u3_noun +u3wdi_apt_140(u3_noun cor) +{ + return u3qdi_apt_140(u3x_at(u3x_con_sam, cor)); +} + + +static c3_o +_in_apt(u3_noun a, u3_weak l, u3_weak r) +{ + if ( u3_nul == a ) { + return c3y; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + if ( (u3_none != l) && + ( (c3y == u3r_sing(n_a, l)) || (c3n == u3qc_gor(n_a, l)) )) { + return c3n; + } + + if ( (u3_none != r) && + ( (c3y == u3r_sing(r, n_a)) || (c3n == u3qc_gor(r, n_a)) )) { + return c3n; + } + + if ( u3_nul != l_a ) { + if ( c3y == u3r_sing(n_a, u3h(l_a)) ) { + return c3n; + } + + if ( c3n == u3qc_mor(n_a, u3h(l_a)) ) { + return c3n; + } + + if ( c3n == _in_apt(l_a, n_a, r) ) { + return c3n; + } + } + + if ( u3_nul != r_a ) { + if ( c3y == u3r_sing(n_a, u3h(r_a)) ) { + return c3n; + } + + if ( c3n == u3qc_mor(n_a, u3h(r_a)) ) { + return c3n; + } + + return _in_apt(r_a, l, n_a); + } + + return c3y; + } +} + +u3_noun +u3qdi_apt(u3_noun a) +{ + return _in_apt(a, u3_none, u3_none); +} + +u3_noun +u3wdi_apt(u3_noun cor) +{ + return u3qdi_apt(u3x_at(u3x_con_sam, cor)); +} diff --git a/vere/pkg/noun/jets/d/in_bif.c b/vere/pkg/noun/jets/d/in_bif.c new file mode 100644 index 0000000..76596b1 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_bif.c @@ -0,0 +1,72 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* internal functions +*/ +static u3_noun +_i_bif_putroot(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a) { + return u3nt(u3k(b), u3_nul, u3_nul); + } + else { + u3_noun n_a, lr_a; + u3x_cell(a, &n_a, &lr_a); + + if ( c3y == u3r_sing(b, n_a) ) { + return u3k(a); + } + else { + u3_noun c, n_c, l_c, r_c; + u3_noun d; + u3_noun l_a, r_a; + u3x_cell(lr_a, &l_a, &r_a); + + if ( c3y == u3qc_gor(b, n_a) ) { + c = _i_bif_putroot(l_a, b); + u3r_trel(c, &n_c, &l_c, &r_c); + d = u3nt(u3k(n_c), + u3k(l_c), + u3nt(u3k(n_a), u3k(r_c), u3k(r_a))); + u3z(c); + return d; + } + else { + c = _i_bif_putroot(r_a, b); + u3r_trel(c, &n_c, &l_c, &r_c); + d = u3nt(u3k(n_c), + u3nt(u3k(n_a), u3k(l_a), u3k(l_c)), + u3k(r_c)); + u3z(c); + return d; + } + } + } +} + +u3_noun +u3wdi_bif(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_bif(a, b); +} + +u3_noun +u3qdi_bif(u3_noun a, + u3_noun b) +{ + u3_noun c, n_c, l_c, r_c; + u3_noun d; + + c = _i_bif_putroot(a, b); + u3r_trel(c, &n_c, &l_c, &r_c); + d = u3nc(u3k(l_c), u3k(r_c)); + u3z(c); + return d; +} diff --git a/vere/pkg/noun/jets/d/in_del.c b/vere/pkg/noun/jets/d/in_del.c new file mode 100644 index 0000000..5871a45 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_del.c @@ -0,0 +1,88 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_rebalance(u3_noun a) +{ + u3_noun l_a, n_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + if ( u3_nul == l_a) { + return u3k(r_a); + } + else if ( u3_nul == r_a) { + return u3k(l_a); + } + else { + u3_noun n_l_a, l_l_a, r_l_a; + u3_noun n_r_a, l_r_a, r_r_a; + u3x_trel(l_a, &n_l_a, &l_l_a, &r_l_a); + u3x_trel(r_a, &n_r_a, &l_r_a, &r_r_a); + + if ( c3y == u3qc_mor(n_l_a, n_r_a) ) { + u3_noun new_right = u3nt(u3k(n_a), + u3k(r_l_a), + u3k(r_a)); + + u3_noun ret = u3nt(u3k(n_l_a), + u3k(l_l_a), + _rebalance(new_right)); + u3z(new_right); + + return ret; + } + else { + u3_noun new_left = u3nt(u3k(n_a), + u3k(l_a), + u3k(l_r_a)); + + u3_noun ret = u3nt(u3k(n_r_a), + _rebalance(new_left), + u3k(r_r_a)); + u3z(new_left); + + return ret; + } + } +} + +u3_noun +u3qdi_del(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return u3_nul; + } + else { + u3_noun l_a, n_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + if ( c3y == u3r_sing(n_a, b) ) { + return _rebalance(a); + } + else { + if ( c3y == u3qc_gor(b, n_a) ) { + return u3nt(u3k(n_a), + u3qdi_del(l_a, b), + u3k(r_a)); + } + else { + return u3nt(u3k(n_a), + u3k(l_a), + u3qdi_del(r_a, b)); + } + } + } +} + +u3_noun +u3wdi_del(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_del(a, b); +} diff --git a/vere/pkg/noun/jets/d/in_dif.c b/vere/pkg/noun/jets/d/in_dif.c new file mode 100644 index 0000000..bff391d --- /dev/null +++ b/vere/pkg/noun/jets/d/in_dif.c @@ -0,0 +1,82 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* internal functions +*/ + +/* RETAIN +*/ +static u3_noun +_i_dif_join(u3_noun d, + u3_noun e) +{ + if ( u3_nul == d ) { + return u3k(e); + } + else if ( u3_nul == e ) { + return u3k(d); + } + else { + u3_noun n_d, lr_d; + u3_noun n_e, lr_e; + u3x_cell(d, &n_d, &lr_d); + u3x_cell(e, &n_e, &lr_e); + + if ( c3y == u3qc_mor(n_d, n_e) ) { + u3_noun l_d, r_d; + u3x_cell(lr_d, &l_d, &r_d); + + return u3nt(u3k(n_d), + u3k(l_d), + _i_dif_join(r_d, e)); + } + else { + u3_noun l_e, r_e; + u3x_cell(lr_e, &l_e, &r_e); + + return u3nt(u3k(n_e), + _i_dif_join(d, l_e), + u3k(r_e)); + } + } +} + +u3_noun +u3wdi_dif(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_dif(a, b); +} + +u3_noun +u3qdi_dif(u3_noun a, + u3_noun b) +{ + if ( u3_nul == b ) { + return u3k(a); + } + else { + u3_noun n_b, l_b, r_b; + u3_noun c, l_c, r_c; + u3_noun d, e; + + u3x_trel(b, &n_b, &l_b, &r_b); + c = u3qdi_bif(a, n_b); + u3x_cell(c, &l_c, &r_c); + + d = u3qdi_dif(l_c, l_b); + e = u3qdi_dif(r_c, r_b); + u3z(c); + + u3_noun pro = _i_dif_join(d, e); + u3z(d); + u3z(e); + + return pro; + } +} diff --git a/vere/pkg/noun/jets/d/in_gas.c b/vere/pkg/noun/jets/d/in_gas.c new file mode 100644 index 0000000..888e070 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_gas.c @@ -0,0 +1,42 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdi_gas(u3_noun a, + u3_noun b) +{ + if ( u3_nul == b ) { + return u3k(a); + } + else { + u3_noun i_b, t_b; + u3x_cell(b, &i_b, &t_b); + + u3_noun c = u3qdi_put(a, i_b); + u3_noun d = u3qdi_gas(c, t_b); + u3z(c); + return d; + } +} + +u3_noun +u3wdi_gas(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_gas(a, b); +} + +u3_noun +u3kdi_gas(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qdi_gas(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/d/in_has.c b/vere/pkg/noun/jets/d/in_has.c new file mode 100644 index 0000000..ea6fb5f --- /dev/null +++ b/vere/pkg/noun/jets/d/in_has.c @@ -0,0 +1,45 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdi_has(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return c3n; + } + else { + u3_noun n_a, lr_a; + u3x_cell(a, &n_a, &lr_a); + + if ( (c3y == u3r_sing(b, n_a)) ) { + return c3y; + } + else { + return ( c3y == u3qc_gor(b, n_a) ) ? u3qdi_has(u3h(lr_a), b) + : u3qdi_has(u3t(lr_a), b); + } + } +} + +u3_noun +u3wdi_has(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_has(a, b); +} + +u3_noun +u3kdi_has(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qdi_has(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/vere/pkg/noun/jets/d/in_int.c b/vere/pkg/noun/jets/d/in_int.c new file mode 100644 index 0000000..fc5bfaa --- /dev/null +++ b/vere/pkg/noun/jets/d/in_int.c @@ -0,0 +1,65 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdi_int(u3_noun a, u3_noun b) +{ + if ( (u3_nul == a) + || (u3_nul == b) ) + { + return u3_nul; + } + else { + u3_noun n_a, l_a, r_a; + u3_noun n_b, l_b, r_b; + + { + u3_noun lr_a, lr_b; + u3x_cell(a, &n_a, &lr_a); + u3x_cell(b, &n_b, &lr_b); + + if ( c3y == u3qc_mor(n_a, n_b) ) { + u3_noun c; + c = a; a = b; b = c; + c = n_a; n_a = n_b; n_b = c; + c = lr_a; lr_a = lr_b; lr_b = c; + } + + u3x_cell(lr_a, &l_a, &r_a); + u3x_cell(lr_b, &l_b, &r_b); + } + + if ( c3y == u3r_sing(n_b, n_a) ) { + return u3nt(u3k(n_a), + u3qdi_int(l_a, l_b), + u3qdi_int(r_a, r_b)); + } + else if ( c3y == u3qc_gor(n_b, n_a) ) { + u3_noun new_l_b = u3nt(u3k(n_b), u3k(l_b), u3_nul); + u3_noun new_a = u3qdi_int(l_a, new_l_b); + + u3z(new_l_b); + return u3kdi_uni(new_a, u3qdi_int(a, r_b)); + } + else { + u3_noun new_r_b = u3nt(u3k(n_b), u3_nul, u3k(r_b)); + u3_noun new_a = u3qdi_int(r_a, new_r_b); + + u3z(new_r_b); + return u3kdi_uni(new_a, u3qdi_int(a, l_b)); + } + } +} + +u3_noun +u3wdi_int(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_int(a, b); +} diff --git a/vere/pkg/noun/jets/d/in_put.c b/vere/pkg/noun/jets/d/in_put.c new file mode 100644 index 0000000..909d48e --- /dev/null +++ b/vere/pkg/noun/jets/d/in_put.c @@ -0,0 +1,87 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qdi_put(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return u3nt(u3k(b), u3_nul, u3_nul); + } + else { + u3_noun n_a, lr_a; + u3x_cell(a, &n_a, &lr_a); + + if ( c3y == u3r_sing(n_a, b) ) { + return u3k(a); + } + else { + u3_noun c, n_c, l_c, r_c; + u3_noun l_a, r_a; + u3x_cell(lr_a, &l_a, &r_a); + + if ( c3y == u3qc_gor(b, n_a) ) { + c = u3qdi_put(l_a, b); + + if ( c3y == u3qc_mor(n_a, u3h(c)) ) { + return u3nt(u3k(n_a), + c, + u3k(r_a)); + } + else { + u3r_trel(c, &n_c, &l_c, &r_c); + { + u3_noun d = u3nt(u3k(n_c), + u3k(l_c), + u3nt(u3k(n_a), u3k(r_c), u3k(r_a))); + + u3z(c); + return d; + } + } + } + else { + c = u3qdi_put(r_a, b); + + if ( c3y == u3qc_mor(n_a, u3h(c)) ) { + return u3nt(u3k(n_a), + u3k(l_a), + c); + } + else { + u3r_trel(c, &n_c, &l_c, &r_c); + { + u3_noun d = u3nt(u3k(n_c), + u3nt(u3k(n_a), u3k(l_a), u3k(l_c)), + u3k(r_c)); + + u3z(c); + return d; + } + } + } + } + } +} + +u3_noun +u3wdi_put(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_put(a, b); +} + +u3_noun +u3kdi_put(u3_noun a, + u3_noun b) +{ + u3_noun pro = u3qdi_put(a, b); + u3z(a); u3z(b); + return pro; +} diff --git a/vere/pkg/noun/jets/d/in_rep.c b/vere/pkg/noun/jets/d/in_rep.c new file mode 100644 index 0000000..fafdad5 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_rep.c @@ -0,0 +1,52 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +// [a] and [out] are TRANSFERRED +// +static void +_in_rep(u3_noun a, u3j_site* sit_u, u3_noun* out) +{ + if ( u3_nul == a ) { + return; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + u3k(n_a); + u3k(l_a); + u3k(r_a); + + *out = u3j_gate_slam(sit_u, u3nc(n_a, *out)); + + _in_rep(l_a, sit_u, out); + _in_rep(r_a, sit_u, out); + + u3z(a); + } +} + +u3_noun +u3qdi_rep(u3_noun a, u3_noun b) +{ + u3_noun out = u3k(u3x_at(u3x_sam_3, b)); + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + _in_rep(u3k(a), &sit_u, &out); + u3j_gate_lose(&sit_u); + + return out; +} + +u3_noun +u3wdi_rep(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_rep(a, b); +} diff --git a/vere/pkg/noun/jets/d/in_run.c b/vere/pkg/noun/jets/d/in_run.c new file mode 100644 index 0000000..2216a5c --- /dev/null +++ b/vere/pkg/noun/jets/d/in_run.c @@ -0,0 +1,59 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +// [a] and [out] are TRANSFERRED +// +static void +_in_run(u3_noun a, u3j_site* sit_u, u3_noun* out) +{ + if ( u3_nul == a ) { + return; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + u3k(n_a); + u3k(l_a); + u3k(r_a); + + { + u3_noun new = u3j_gate_slam(sit_u, n_a); + u3_noun pro = u3qdi_put(*out, new); + + u3z(new); + u3z(*out); + *out = pro; + } + + _in_run(l_a, sit_u, out); + _in_run(r_a, sit_u, out); + + u3z(a); + } +} + +u3_noun +u3qdi_run(u3_noun a, u3_noun b) +{ + u3_noun out = u3_nul; + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + _in_run(u3k(a), &sit_u, &out); + u3j_gate_lose(&sit_u); + + return out; +} + +u3_noun +u3wdi_run(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_run(a, b); +} diff --git a/vere/pkg/noun/jets/d/in_tap.c b/vere/pkg/noun/jets/d/in_tap.c new file mode 100644 index 0000000..a9af4f1 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_tap.c @@ -0,0 +1,46 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_tap_in(u3_noun a, + u3_noun b) +{ + if ( u3_nul == a ) { + return b; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + return _tap_in(r_a, + u3nc(u3k(n_a), + _tap_in(l_a, b))); + } +} + +u3_noun +u3qdi_tap(u3_noun a) +{ + return _tap_in(a, u3_nul); +} + +u3_noun +u3wdi_tap(u3_noun cor) +{ + u3_noun a; + u3x_mean(cor, u3x_con_sam, &a, 0); + return u3qdi_tap(a); +} + +u3_noun +u3kdi_tap(u3_noun a) +{ + u3_noun b = u3qdi_tap(a); + u3z(a); + return b; +} diff --git a/vere/pkg/noun/jets/d/in_uni.c b/vere/pkg/noun/jets/d/in_uni.c new file mode 100644 index 0000000..504ddcb --- /dev/null +++ b/vere/pkg/noun/jets/d/in_uni.c @@ -0,0 +1,98 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* internal functions +*/ +static u3_noun +_in_uni(u3_noun a, u3_noun b) +{ + if ( u3_nul == a ) { + return u3k(b); + } + else if ( u3_nul == b ) { + return u3k(a); + } + else { + u3_noun n_a, l_a, r_a, + n_b, l_b, r_b, + neb, sub, naw, pro; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_trel(b, &n_b, &l_b, &r_b); + + if ( c3n == u3qc_mor(n_a, n_b) ) { + if ( c3y == u3r_sing(n_a, n_b) ) { + return u3nt(u3k(n_b), _in_uni(l_a, l_b), _in_uni(r_a, r_b)); + } + else if ( c3y == u3qc_gor(n_a, n_b) ) { + naw = u3nt(u3k(n_a), u3k(l_a), u3_nul); + sub = _in_uni(naw, l_b); + neb = u3nt(u3k(n_b), sub, u3k(r_b)); + pro = _in_uni(r_a, neb); + u3z(naw); u3z(neb); + return pro; + } + else { + naw = u3nt(u3k(n_a), u3_nul, u3k(r_a)); + sub = _in_uni(naw, r_b); + neb = u3nt(u3k(n_b), u3k(l_b), sub); + pro = _in_uni(l_a, neb); + u3z(naw); u3z(neb); + return pro; + } + } + else if ( c3y == u3r_sing(n_b, n_a) ) { + return u3nt(u3k(n_b), _in_uni(l_a, l_b), _in_uni(r_a, r_b)); + } + else if ( c3y == u3qc_gor(n_b, n_a) ) { + neb = u3nt(u3k(n_b), u3k(l_b), u3_nul); + sub = _in_uni(l_a, neb); + naw = u3nt(u3k(n_a), sub, u3k(r_a)); + pro = _in_uni(naw, r_b); + u3z(neb); u3z(naw); + return pro; + } + else { + neb = u3nt(u3k(n_b), u3_nul, u3k(r_b)); + sub = _in_uni(r_a, neb); + naw = u3nt(u3k(n_a), u3k(l_a), sub); + pro = _in_uni(naw, l_b); + u3z(neb); u3z(naw); + return pro; + } + } +} + +u3_noun +u3kdi_uni(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qdi_uni(a, b); + u3z(a); u3z(b); + return c; +} + +u3_noun +u3qdi_uni(u3_noun a, + u3_noun b) +{ + if ( c3y == u3r_sing(a, b) ) { + return u3k(a); + } + else { + return _in_uni(a, b); + } +} + +u3_noun +u3wdi_uni(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_uni(a, b); +} + diff --git a/vere/pkg/noun/jets/d/in_wyt.c b/vere/pkg/noun/jets/d/in_wyt.c new file mode 100644 index 0000000..2ae72fa --- /dev/null +++ b/vere/pkg/noun/jets/d/in_wyt.c @@ -0,0 +1,35 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +STATIC_ASSERT( (UINT32_MAX > u3a_cells), + "width precision" ); + +static c3_w +_wyt_in(u3_noun a) +{ + if ( u3_nul == a ) { + return 0; + } + else { + u3_noun l_a, r_a; + u3x_trel(a, 0, &l_a, &r_a); + + return 1 + _wyt_in(l_a) + _wyt_in(r_a); + } +} + +u3_noun +u3qdi_wyt(u3_noun a) +{ + return u3i_word(_wyt_in(a)); +} + +u3_noun +u3wdi_wyt(u3_noun cor) +{ + return u3qdi_wyt(u3x_at(u3x_con_2, cor)); +} diff --git a/vere/pkg/noun/jets/e/adler.c b/vere/pkg/noun/jets/e/adler.c new file mode 100644 index 0000000..d7e1211 --- /dev/null +++ b/vere/pkg/noun/jets/e/adler.c @@ -0,0 +1,127 @@ +#include <imprison.h> +#include <jets/k.h> +#include <log.h> +#include <nock.h> +#include <retrieve.h> +#include <types.h> +#include <xtract.h> + +static void _x_octs(u3_noun octs, u3_atom* p_octs, u3_atom* q_octs) { + + if (c3n == u3r_mean(octs, + 2, p_octs, + 3, q_octs, 0)){ + u3m_bail(c3__exit); + } + + if (c3n == u3a_is_atom(*p_octs) || + c3n == u3a_is_atom(*q_octs)) { + u3m_bail(c3__exit); + } +} + +static c3_o _x_octs_buffer(u3_atom* p_octs, u3_atom *q_octs, + c3_w* p_octs_w, c3_y** buf_y, + c3_w* len_w, c3_w* lead_w) +{ + if (c3n == u3r_safe_word(*p_octs, p_octs_w)) { + return c3n; + } + + *len_w = u3r_met(3, *q_octs); + + if (c3y == u3a_is_cat(*q_octs)) { + *buf_y = (c3_y*)q_octs; + } + else { + u3a_atom* ptr_a = u3a_to_ptr(*q_octs); + *buf_y = (c3_y*)ptr_a->buf_w; + } + + *lead_w = 0; + + if (*p_octs_w > *len_w) { + *lead_w = *p_octs_w - *len_w; + } + else { + *len_w = *p_octs_w; + } + + return c3y; +} + +#define BASE 65521 +#define NMAX 5552 + +u3_noun _qe_adler32(u3_noun octs) +{ + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w, len_w, lead_w; + c3_y *buf_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &buf_y, + &len_w, &lead_w)) { + return u3_none; + } + + c3_w adler_w, sum2_w; + + adler_w = 0x1; + sum2_w = 0x0; + + c3_w pos_w = 0; + + // Process all non-zero bytes + // + while (pos_w < len_w) { + + c3_w rem_w = (len_w - pos_w); + + if (rem_w > NMAX) { + rem_w = NMAX; + } + + while (rem_w--) { + adler_w += *(buf_y + pos_w++); + sum2_w += adler_w; + } + + adler_w %= BASE; + sum2_w %= BASE; + } + + // Process leading zeros + // + while (pos_w < p_octs_w) { + + c3_w rem_w = (p_octs_w - pos_w); + + if (rem_w > NMAX) { + rem_w = NMAX; + } + + // leading zeros: adler sum is unchanged + sum2_w += rem_w*adler_w; + pos_w += rem_w; + + adler_w %= BASE; + sum2_w %= BASE; + } + + return u3i_word(sum2_w << 16 | adler_w); +} + + +u3_noun +u3we_adler32(u3_noun cor) +{ + u3_noun octs; + + u3x_mean(cor, u3x_sam, &octs, 0); + + return _qe_adler32(octs); +} diff --git a/vere/pkg/noun/jets/e/aes_cbc.c b/vere/pkg/noun/jets/e/aes_cbc.c new file mode 100644 index 0000000..f5369e0 --- /dev/null +++ b/vere/pkg/noun/jets/e/aes_cbc.c @@ -0,0 +1,182 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + +/* All of the CBC hoon truncates its key and prv inputs by passing them to + * the ECB functions, which truncate them, hence the raw u3r_bytes unpacking. + */ + +typedef int (*urcrypt_cbc)(c3_y**, + size_t*, + c3_y*, + c3_y*, + urcrypt_realloc_t); + + static u3_atom + _cqea_cbc_help(c3_y* key_y, u3_atom iv, u3_atom msg, urcrypt_cbc low_f) + { + u3_atom ret; + c3_w met_w; + c3_y iv_y[16]; + c3_y* msg_y = u3r_bytes_all(&met_w, msg); + size_t len = met_w; + + u3r_bytes(0, 16, iv_y, iv); + if ( 0 != (*low_f)(&msg_y, &len, key_y, iv_y, &u3a_realloc) ) { + ret = u3_none; + } + else { + ret = u3i_bytes(len, msg_y); + } + u3a_free(msg_y); + + return ret; + } + + static u3_atom + _cqea_cbca_en(u3_atom key, + u3_atom iv, + u3_atom msg) + { + c3_y key_y[16]; + u3r_bytes(0, 16, key_y, key); + return _cqea_cbc_help(key_y, iv, msg, &urcrypt_aes_cbca_en); + } + + u3_noun + u3wea_cbca_en(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("cbca-en", _cqea_cbca_en(a, b, c)); + } + } + + static u3_atom + _cqea_cbca_de(u3_atom key, + u3_atom iv, + u3_atom msg) + { + c3_y key_y[16]; + u3r_bytes(0, 16, key_y, key); + return _cqea_cbc_help(key_y, iv, msg, &urcrypt_aes_cbca_de); + } + + u3_noun + u3wea_cbca_de(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("cbca-de", _cqea_cbca_de(a, b, c)); + } + } + + static u3_atom + _cqea_cbcb_en(u3_atom key, + u3_atom iv, + u3_atom msg) + { + c3_y key_y[24]; + u3r_bytes(0, 24, key_y, key); + return _cqea_cbc_help(key_y, iv, msg, &urcrypt_aes_cbcb_en); + } + + u3_noun + u3wea_cbcb_en(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("cbcb-en", _cqea_cbcb_en(a, b, c)); + } + } + + static u3_atom + _cqea_cbcb_de(u3_atom key, + u3_atom iv, + u3_atom msg) + { + c3_y key_y[24]; + u3r_bytes(0, 24, key_y, key); + return _cqea_cbc_help(key_y, iv, msg, &urcrypt_aes_cbcb_de); + } + + u3_noun + u3wea_cbcb_de(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("cbcb-de", _cqea_cbcb_de(a, b, c)); + } + } + + static u3_atom + _cqea_cbcc_en(u3_atom key, + u3_atom iv, + u3_atom msg) + { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + return _cqea_cbc_help(key_y, iv, msg, &urcrypt_aes_cbcc_en); + } + + u3_noun + u3wea_cbcc_en(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("cbcc-en", _cqea_cbcc_en(a, b, c)); + } + } + + static u3_atom + _cqea_cbcc_de(u3_atom key, + u3_atom iv, + u3_atom msg) + { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + return _cqea_cbc_help(key_y, iv, msg, &urcrypt_aes_cbcc_de); + } + + u3_noun + u3wea_cbcc_de(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("cbcc-de", _cqea_cbcc_de(a, b, c)); + } + } diff --git a/vere/pkg/noun/jets/e/aes_ecb.c b/vere/pkg/noun/jets/e/aes_ecb.c new file mode 100644 index 0000000..eff536d --- /dev/null +++ b/vere/pkg/noun/jets/e/aes_ecb.c @@ -0,0 +1,166 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + +typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); + + + /* All of the ECB hoon truncates its key and blk inputs with +fe, in these + * jets we unpack with an unconditional u3r_bytes */ + + static u3_atom + _cqea_ecb_help(c3_y* key_y, u3_atom blk, urcrypt_ecb low_f) + { + c3_y blk_y[16], out_y[16]; + + u3r_bytes(0, 16, blk_y, blk); + + if ( 0 != (*low_f)(key_y, blk_y, out_y) ) { + return u3_none; + } + else { + return u3i_bytes(16, out_y); + } + } + + static u3_atom + _cqea_ecba_en(u3_atom key, + u3_atom blk) + { + c3_y key_y[16]; + u3r_bytes(0, 16, key_y, key); + return _cqea_ecb_help(key_y, blk, &urcrypt_aes_ecba_en); + } + + u3_noun + u3wea_ecba_en(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("ecba-en", _cqea_ecba_en(a, b)); + } + } + + static u3_atom + _cqea_ecba_de(u3_atom key, + u3_atom blk) + { + c3_y key_y[16]; + u3r_bytes(0, 16, key_y, key); + return _cqea_ecb_help(key_y, blk, &urcrypt_aes_ecba_de); + } + + u3_noun + u3wea_ecba_de(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("ecba-de", _cqea_ecba_de(a, b)); + } + } + + static u3_atom + _cqea_ecbb_en(u3_atom key, + u3_atom blk) + { + c3_y key_y[24]; + u3r_bytes(0, 24, key_y, key); + return _cqea_ecb_help(key_y, blk, &urcrypt_aes_ecbb_en); + } + + u3_noun + u3wea_ecbb_en(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("ecbb-en", _cqea_ecbb_en(a, b)); + } + } + + static u3_atom + _cqea_ecbb_de(u3_atom key, + u3_atom blk) + { + c3_y key_y[24]; + u3r_bytes(0, 24, key_y, key); + return _cqea_ecb_help(key_y, blk, &urcrypt_aes_ecbb_de); + } + + u3_noun + u3wea_ecbb_de(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("ecbb-de", _cqea_ecbb_de(a, b)); + } + } + + static u3_atom + _cqea_ecbc_en(u3_atom key, + u3_atom blk) + { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + return _cqea_ecb_help(key_y, blk, &urcrypt_aes_ecbc_en); + } + + u3_noun + u3wea_ecbc_en(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("ecbc-en", _cqea_ecbc_en(a, b)); + } + } + + static u3_atom + _cqea_ecbc_de(u3_atom key, + u3_atom blk) + { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + return _cqea_ecb_help(key_y, blk, &urcrypt_aes_ecbc_de); + } + + u3_noun + u3wea_ecbc_de(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("ecbc-de", _cqea_ecbc_de(a, b)); + } + } diff --git a/vere/pkg/noun/jets/e/aes_siv.c b/vere/pkg/noun/jets/e/aes_siv.c new file mode 100644 index 0000000..f88ba6a --- /dev/null +++ b/vere/pkg/noun/jets/e/aes_siv.c @@ -0,0 +1,370 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + +typedef int (*urcrypt_siv)(c3_y*, size_t, + urcrypt_aes_siv_data*, size_t, + c3_y*, c3_y[16], c3_y*); + + +// soc_w = number of items +// mat_w = size in bytes of assoc array +// dat_w = size of allocation (array + atom storage) +static void +_cqea_measure_ads(u3_noun ads, c3_w* soc_w, c3_w *mat_w, c3_w *dat_w) +{ + u3_noun i, t; + c3_w a_w, b_w, tmp_w; + + for ( a_w = b_w = 0, t = ads; u3_nul != t; ++a_w ) { + u3x_cell(t, &i, &t); + if ( c3n == u3ud(i) ) { + u3m_bail(c3__exit); + return; + } + else { + tmp_w = b_w; + b_w += u3r_met(3, i); + if ( b_w < tmp_w ) { + u3m_bail(c3__fail); + return; + } + } + } + + // check for size overflows + tmp_w = a_w * sizeof(urcrypt_aes_siv_data); + if ( (tmp_w / a_w) != sizeof(urcrypt_aes_siv_data) ) { + u3m_bail(c3__fail); + } + else if ( (*dat_w = tmp_w + b_w) < tmp_w ) { + u3m_bail(c3__fail); + } + else { + *soc_w = a_w; + *mat_w = tmp_w; + } +} + +// assumes ads is a valid (list @) because it's already been measured +static void +_cqea_encode_ads(u3_noun ads, + c3_w mat_w, + urcrypt_aes_siv_data *dat_u) +{ + c3_w met_w; + u3_noun i, t; + urcrypt_aes_siv_data *cur_u; + c3_y *dat_y = ((c3_y*) dat_u) + mat_w; + + for ( cur_u = dat_u, t = ads; u3_nul != t; t = u3t(t), ++cur_u ) { + i = u3h(t); + met_w = u3r_met(3, i); + u3r_bytes(0, met_w, dat_y, i); + cur_u->length = met_w; + cur_u->bytes = dat_y; + dat_y += met_w; + } +} + +static void +_cqea_ads_free(urcrypt_aes_siv_data *dat_u) +{ + if ( NULL != dat_u ) { + u3a_free(dat_u); + } +} + +static urcrypt_aes_siv_data* +_cqea_ads_alloc(u3_noun ads, c3_w *soc_w) +{ + if ( !ads ) { + *soc_w = 0; + return NULL; + } + else { + c3_w mat_w, dat_w; + urcrypt_aes_siv_data *dat_u; + + _cqea_measure_ads(ads, soc_w, &mat_w, &dat_w); + dat_u = u3a_malloc(dat_w); + _cqea_encode_ads(ads, mat_w, dat_u); + return dat_u; + } +} + +static u3_noun +_cqea_siv_en(c3_y* key_y, + c3_w key_w, + u3_noun ads, + u3_atom txt, + urcrypt_siv low_f) +{ + u3_noun ret; + c3_w txt_w, soc_w; + c3_y *txt_y, *out_y, iv_y[16]; + urcrypt_aes_siv_data *dat_u; + + dat_u = _cqea_ads_alloc(ads, &soc_w); + txt_y = u3r_bytes_all(&txt_w, txt); + out_y = u3a_malloc(txt_w); + + ret = ( 0 != (*low_f)(txt_y, txt_w, dat_u, soc_w, key_y, iv_y, out_y) ) + ? u3_none + : u3nt(u3i_bytes(16, iv_y), + u3i_words(1, &txt_w), + u3i_bytes(txt_w, out_y)); + + u3a_free(txt_y); + u3a_free(out_y); + _cqea_ads_free(dat_u); + return ret; +} + +static u3_noun +_cqea_siv_de(c3_y* key_y, + c3_w key_w, + u3_noun ads, + u3_atom iv, + u3_atom len, + u3_atom txt, + urcrypt_siv low_f) +{ + c3_w txt_w; + if ( !u3r_word_fit(&txt_w, len) ) { + return u3m_bail(c3__fail); + } + else { + u3_noun ret; + c3_w soc_w; + c3_y *txt_y, *out_y, iv_y[16]; + urcrypt_aes_siv_data *dat_u; + + u3r_bytes(0, 16, iv_y, iv); + dat_u = _cqea_ads_alloc(ads, &soc_w); + txt_y = u3r_bytes_alloc(0, txt_w, txt); + out_y = u3a_malloc(txt_w); + + if ( 0 != (*low_f)(txt_y, txt_w, dat_u, soc_w, key_y, iv_y, out_y) ) { + return u3m_bail(c3__evil); + } + + ret = u3nc(0, u3i_bytes(txt_w, out_y)); + + u3a_free(txt_y); + u3a_free(out_y); + _cqea_ads_free(dat_u); + + return ret; + } +} + +// the siv* hoon doesn't explicitly check keysizes, but all of these functions +// have fixed maximum keysizes, so we will punt if we get a key that is too +// large. + +static u3_noun +_cqea_siva_en(u3_atom key, + u3_noun ads, + u3_atom txt) +{ + if ( u3r_met(3, key) > 32 ) { + return u3_none; + } + else { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + return _cqea_siv_en(key_y, 32, ads, txt, &urcrypt_aes_siva_en); + } +} + +u3_noun +u3wea_siva_en(u3_noun cor) +{ + u3_noun key, ads, txt; + + if ( c3n == u3r_mean(cor, u3x_sam, &txt, + u3x_con_sam_2, &key, + u3x_con_sam_3, &ads, 0) || + c3n == u3ud(key) || + c3n == u3ud(txt) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("siva-en", _cqea_siva_en(key, ads, txt)); + } +} + +static u3_noun +_cqea_siva_de(u3_atom key, + u3_noun ads, + u3_atom iv, + u3_atom len, + u3_atom txt) +{ + if ( u3r_met(3, key) > 32 ) { + return u3_none; + } + else { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + return _cqea_siv_de(key_y, 32, ads, iv, len, txt, &urcrypt_aes_siva_de); + } +} + +u3_noun +u3wea_siva_de(u3_noun cor) +{ + u3_noun key, ads, iv, len, txt; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &iv, + u3x_sam_6, &len, + u3x_sam_7, &txt, + u3x_con_sam_2, &key, + u3x_con_sam_3, &ads, 0) || + c3n == u3ud(key) || + c3n == u3ud(txt) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("siva-de", _cqea_siva_de(key, ads, iv, len, txt)); + } +} + +static u3_noun +_cqea_sivb_en(u3_atom key, + u3_noun ads, + u3_atom txt) +{ + if ( u3r_met(3, key) > 48 ) { + return u3_none; + } + else { + c3_y key_y[48]; + u3r_bytes(0, 48, key_y, key); + return _cqea_siv_en(key_y, 48, ads, txt, &urcrypt_aes_sivb_en); + } +} + + +u3_noun +u3wea_sivb_en(u3_noun cor) +{ + u3_noun key, ads, txt; + + if ( c3n == u3r_mean(cor, u3x_sam, &txt, + u3x_con_sam_2, &key, + u3x_con_sam_3, &ads, 0) || + c3n == u3ud(key) || + c3n == u3ud(txt) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("sivb-en", _cqea_sivb_en(key, ads, txt)); + } +} + +static u3_noun +_cqea_sivb_de(u3_atom key, + u3_noun ads, + u3_atom iv, + u3_atom len, + u3_atom txt) +{ + if ( u3r_met(3, key) > 48 ) { + return u3_none; + } + else { + c3_y key_y[48]; + u3r_bytes(0, 48, key_y, key); + return _cqea_siv_de(key_y, 48, ads, iv, len, txt, &urcrypt_aes_sivb_de); + } +} + +u3_noun +u3wea_sivb_de(u3_noun cor) +{ + u3_noun key, ads, iv, len, txt; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &iv, + u3x_sam_6, &len, + u3x_sam_7, &txt, + u3x_con_sam_2, &key, + u3x_con_sam_3, &ads, 0) || + c3n == u3ud(key) || + c3n == u3ud(txt) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("sivb-de", _cqea_sivb_de(key, ads, iv, len, txt)); + } +} + +static u3_noun +_cqea_sivc_en(u3_atom key, + u3_noun ads, + u3_atom txt) +{ + if ( u3r_met(3, key) > 64 ) { + return u3_none; + } + else { + c3_y key_y[64]; + u3r_bytes(0, 64, key_y, key); + return _cqea_siv_en(key_y, 64, ads, txt, &urcrypt_aes_sivc_en); + } +} + +u3_noun +u3wea_sivc_en(u3_noun cor) +{ + u3_noun key, ads, txt; + + if ( c3n == u3r_mean(cor, u3x_sam, &txt, + u3x_con_sam_2, &key, + u3x_con_sam_3, &ads, 0) || + c3n == u3ud(key) || + c3n == u3ud(txt) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("sivc-en", _cqea_sivc_en(key, ads, txt)); + } +} + +static u3_noun +_cqea_sivc_de(u3_atom key, + u3_noun ads, + u3_atom iv, + u3_atom len, + u3_atom txt) +{ + if ( u3r_met(3, key) > 64 ) { + return u3_none; + } + else { + c3_y key_y[64]; + u3r_bytes(0, 64, key_y, key); + return _cqea_siv_de(key_y, 64, ads, iv, len, txt, &urcrypt_aes_sivc_de); + } +} + +u3_noun +u3wea_sivc_de(u3_noun cor) +{ + u3_noun key, ads, iv, len, txt; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &iv, + u3x_sam_6, &len, + u3x_sam_7, &txt, + u3x_con_sam_2, &key, + u3x_con_sam_3, &ads, 0) || + c3n == u3ud(key) || + c3n == u3ud(txt) ) { + return u3m_bail(c3__exit); + } else { + return u3l_punt("sivc-de", _cqea_sivc_de(key, ads, iv, len, txt)); + } +} diff --git a/vere/pkg/noun/jets/e/argon2.c b/vere/pkg/noun/jets/e/argon2.c new file mode 100644 index 0000000..e52d42c --- /dev/null +++ b/vere/pkg/noun/jets/e/argon2.c @@ -0,0 +1,151 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + +/* helpers +*/ + + static int + argon2_alloc(uint8_t** output, size_t bytes) + { + *output = u3a_malloc(bytes); + return 1; + } + + static void + argon2_free(uint8_t* memory, size_t bytes) + { + u3a_free(memory); + } + + static c3_t + _cqear_unpack_type(c3_y* out, u3_atom in) + { + switch ( in ) { + default: + return 0; + case c3__d: + *out = urcrypt_argon2_d; + return 1; + case c3__i: + *out = urcrypt_argon2_i; + return 1; + case c3__id: + *out = urcrypt_argon2_id; + return 1; + case c3__u: + *out = urcrypt_argon2_u; + return 1; + } + } + + + static u3_atom + _cqe_argon2( // configuration params, + u3_atom out, u3_atom type, u3_atom version, + u3_atom threads, u3_atom mem_cost, u3_atom time_cost, + u3_atom wik, u3_atom key, u3_atom wix, u3_atom extra, + // input params + u3_atom wid, u3_atom dat, u3_atom wis, u3_atom sat ) + { + c3_y typ_u; + c3_w out_w, wik_w, wix_w, wid_w, wis_w, ver_w, ted_w, mem_w, tim_w; + + if ( !(u3r_word_fit(&out_w, out) && + u3r_word_fit(&wik_w, wik) && + u3r_word_fit(&wix_w, wix) && + u3r_word_fit(&wid_w, wid) && + u3r_word_fit(&wis_w, wis)) ) { + // too big to allocate + return u3m_bail(c3__fail); + } + else if ( !(_cqear_unpack_type(&typ_u, type) && + u3r_word_fit(&ver_w, version) && + u3r_word_fit(&ted_w, threads) && + u3r_word_fit(&mem_w, mem_cost) && + u3r_word_fit(&tim_w, time_cost)) ) { + return u3_none; + } + else { + u3_atom ret; + c3_y *key_y = u3r_bytes_alloc(0, wik_w, key), + *ex_y = u3r_bytes_alloc(0, wix_w, extra), + *dat_y = u3r_bytes_alloc(0, wid_w, dat), + *sat_y = u3r_bytes_alloc(0, wis_w, sat), + *out_y = u3a_malloc(out_w); + + const c3_c* err_c = urcrypt_argon2( + typ_u, ver_w, ted_w, mem_w, tim_w, + wik_w, key_y, + wix_w, ex_y, + wid_w, dat_y, + wis_w, sat_y, + out_w, out_y, + &argon2_alloc, + &argon2_free); + + u3a_free(key_y); + u3a_free(ex_y); + u3a_free(dat_y); + u3a_free(sat_y); + + if ( NULL == err_c ) { + ret = u3i_bytes(out_w, out_y); + } + else { + ret = u3_none; + u3l_log("argon2-error: %s", err_c); + } + + u3a_free(out_y); + return ret; + } + } + + u3_noun + u3we_argon2(u3_noun cor) + { + u3_noun // configuration params + out, type, version, + threads, mem_cost, time_cost, + wik, key, wix, extra, + // input params + wid, dat, wis, sat, + // for use during unpacking + wmsg, wsat, arg, brg, wkey, wext; + + // the hoon code for argon2 takes configuration parameters, + // and then produces a gate. we jet that inner gate. + // this does mean that the config params have gotten buried + // pretty deep in the subject, hence the +510. + if ( c3n == u3r_mean(cor, u3x_sam_2, &wmsg, + u3x_sam_3, &wsat, + 510, &arg, 0) || + u3r_cell(wmsg, &wid, &dat) || u3ud(wid) || u3ud(dat) || + u3r_cell(wsat, &wis, &sat) || u3ud(wis) || u3ud(sat) || + // + u3r_qual(arg, &out, &type, &version, &brg) || + u3ud(out) || u3ud(type) || u3ud(version) || + // + u3r_qual(brg, &threads, &mem_cost, &time_cost, &arg) || + u3ud(threads) || u3ud(mem_cost) || u3ud(time_cost) || + // + u3r_cell(arg, &wkey, &wext) || + u3r_cell(wkey, &wik, &key) || u3ud(wik) || u3ud(key) || + u3r_cell(wext, &wix, &extra) || u3ud(wix) || u3ud(extra) + ) + { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("argon2", + _cqe_argon2(out, type, version, + threads, mem_cost, time_cost, + wik, key, wix, extra, + wid, dat, wis, sat)); + } + } diff --git a/vere/pkg/noun/jets/e/base.c b/vere/pkg/noun/jets/e/base.c new file mode 100644 index 0000000..8bbc761 --- /dev/null +++ b/vere/pkg/noun/jets/e/base.c @@ -0,0 +1,152 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qe_en_base16(u3_atom len, u3_atom dat) +{ + if ( c3n == u3a_is_cat(len) ) { + return u3m_bail(c3__fail); + } + else { + c3_w len_w = (c3_w)len; + u3i_slab sab_u; + + u3i_slab_bare(&sab_u, 4, len_w); + sab_u.buf_w[sab_u.len_w - 1] = 0; + + { + c3_y* buf_y = sab_u.buf_y; + c3_y inp_y; + + while ( len_w-- ) { + inp_y = u3r_byte(len_w, dat); + + *buf_y++ = u3s_dit_y[inp_y >> 4]; + *buf_y++ = u3s_dit_y[inp_y & 0xf]; + } + } + + return u3i_slab_moot_bytes(&sab_u); + } +} + +static inline c3_o +_of_hex_digit(c3_y inp_y, c3_y* out_y) +{ + if ( inp_y >= '0' && inp_y <= '9' ) { + *out_y = inp_y - '0'; + return c3y; + } + else if ( inp_y >= 'a' && inp_y <= 'f' ) { + *out_y = inp_y - 87; + return c3y; + } + else if ( inp_y >= 'A' && inp_y <= 'F' ) { + *out_y = inp_y - 55; + return c3y; + } + + return c3n; +} + +static inline c3_o +_of_hex_odd(u3_atom inp, c3_w len_w, c3_w byt_w, c3_y* buf_y) +{ + c3_y low_y, hig_y, lit_y, hit_y; + + hig_y = u3r_byte(--byt_w, inp); + + while ( --len_w ) { + low_y = u3r_byte(--byt_w, inp); + + if ( (c3n == _of_hex_digit(low_y, &lit_y)) + || (c3n == _of_hex_digit(hig_y, &hit_y)) ) + { + return c3n; + } + else { + *buf_y++ = (hit_y & 0xf) ^ (lit_y << 4); + } + + hig_y = u3r_byte(--byt_w, inp); + } + + if ( c3n == _of_hex_digit(hig_y, &hit_y) ) { + return c3n; + } + else { + *buf_y = hit_y & 0xf; + } + + return c3y; +} + +static inline c3_o +_of_hex_even(u3_atom inp, c3_w len_w, c3_y* buf_y) +{ + c3_y lit_y, hit_y; + c3_s inp_s; + + while ( len_w-- ) { + inp_s = u3r_short(len_w, inp); + + if ( (c3n == _of_hex_digit(inp_s & 0xff, &lit_y)) + || (c3n == _of_hex_digit(inp_s >> 8, &hit_y)) ) + { + return c3n; + } + else { + *buf_y++ = (hit_y & 0xf) ^ (lit_y << 4); + } + } + + return c3y; +} + +u3_noun +u3qe_de_base16(u3_atom inp) +{ + c3_w len_w = u3r_met(4, inp); + u3i_slab sab_u; + + u3i_slab_bare(&sab_u, 3, len_w); + sab_u.buf_w[sab_u.len_w - 1] = 0; + + // even byte-length input can be parsed in aligned, 16-bit increments, + // but odd byte-length input cannot, and is expressed more simply in bytes. + // + { + c3_w byt_w = u3r_met(3, inp); + c3_o ret_o = ( byt_w & 1 ) + ? _of_hex_odd(inp, len_w, byt_w, sab_u.buf_y) + : _of_hex_even(inp, len_w, sab_u.buf_y); + + if ( c3n == ret_o ) { + u3i_slab_free(&sab_u); + return u3_nul; + } + else { + u3_noun dat = u3i_slab_mint_bytes(&sab_u); + return u3nt(u3_nul, u3i_word(len_w), dat); + } + } +} + +u3_noun +u3we_en_base16(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qe_en_base16(u3x_atom(a), u3x_atom(b)); +} + +u3_noun +u3we_de_base16(u3_noun cor) +{ + u3_noun sam = u3x_at(u3x_sam, cor); + return u3qe_de_base16(u3x_atom(sam)); +} diff --git a/vere/pkg/noun/jets/e/blake.c b/vere/pkg/noun/jets/e/blake.c new file mode 100644 index 0000000..cac4c48 --- /dev/null +++ b/vere/pkg/noun/jets/e/blake.c @@ -0,0 +1,163 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqe_blake2b(u3_atom wid, u3_atom dat, + u3_atom wik, u3_atom dak, + u3_atom out) + { + c3_w wid_w; + if ( !u3r_word_fit(&wid_w, wid) ) { + // impossible to represent an atom this large + return u3m_bail(c3__fail); + } + else { + // the hoon adjusts these widths to its liking + int err; + c3_y out_y[64], dak_y[64]; + c3_w wik_w = c3_min(wik, 64), + out_w = c3_max(1, c3_min(out, 64)); + c3_y *dat_y = u3r_bytes_alloc(0, wid_w, dat); + + u3r_bytes(0, wik_w, dak_y, dak); + err = urcrypt_blake2(wid_w, dat_y, wik_w, dak_y, out_w, out_y); + u3a_free(dat_y); + + if ( 0 == err ) { + return u3i_bytes(out_w, out_y); + } + else { + return u3_none; + } + } + } + + u3_noun + u3we_blake2b(u3_noun cor) + { + u3_noun msg, key, out, // arguments + wid, dat, // destructured msg + wik, dak; // destructured key + + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, + u3x_sam_6, &key, + u3x_sam_7, &out, 0) || + u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || + u3r_cell(key, &wik, &dak) || u3ud(wik) || u3ud(dak) || + u3ud(out) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("blake2b", _cqe_blake2b(wid, dat, wik, dak, out)); + } + } + + static u3_atom + _cqe_blake3_hash(u3_atom wid, u3_atom dat, + u3_atom key, u3_atom flags, u3_atom out) + { + c3_w wid_w, out_w; + if ( !u3r_word_fit(&wid_w, wid) || !u3r_word_fit(&out_w, out) ) { + return u3m_bail(c3__fail); + } + else { + c3_y key_y[32]; + u3r_bytes(0, 32, key_y, key); + c3_y flags_y = u3r_byte(0, flags); + c3_y *dat_y = u3r_bytes_alloc(0, wid_w, dat); + u3i_slab sab_u; + u3i_slab_bare(&sab_u, 3, out_w); + c3_y* out_y = sab_u.buf_y; + urcrypt_blake3_hash(wid_w, dat_y, key_y, flags_y, out, out_y); + u3a_free(dat_y); + return u3i_slab_mint(&sab_u); + } + } + + u3_noun + u3we_blake3_hash(u3_noun cor) + { + u3_noun out, msg, // arguments + wid, dat, // destructured msg + sam, key, flags; // context + + if ( c3n == u3r_mean(cor, u3x_sam_2, &out, + u3x_sam_3, &msg, + u3x_con_sam, &sam, 0) || + u3ud(out) || + u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || + u3r_cell(sam, &key, &flags) || u3ud(key) || u3ud(flags) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("blake3_hash", _cqe_blake3_hash(wid, dat, key, flags, out)); + } + } + + static u3_noun + _cqe_blake3_chunk_output(u3_atom wid, u3_atom dat, u3_atom cv, u3_atom counter, u3_atom flags) + { + c3_w wid_w; + if ( !u3r_word_fit(&wid_w, wid) ) { + return u3m_bail(c3__fail); + } else { + c3_y cv_y[32], block_y[64], block_len; + c3_y *dat_y = u3r_bytes_alloc(0, wid_w, dat); + c3_d counter_d = u3r_chub(0, counter); + c3_y flags_y = u3r_byte(0, flags); + u3r_bytes(0, 32, cv_y, cv); + urcrypt_blake3_chunk_output(wid_w, dat_y, cv_y, block_y, &block_len, &counter_d, &flags_y); + return u3i_cell(u3i_bytes(32, cv_y), u3i_qual(u3k(counter), u3i_bytes(64, block_y), block_len, flags_y)); + } + } + + u3_noun + u3we_blake3_chunk_output(u3_noun cor) + { + u3_noun counter, msg, // arguments + wid, dat, // destructured msg + key, flags; // context + + if ( c3n == u3r_mean(cor, u3x_sam_2, &counter, + u3x_sam_3, &msg, + u3x_con_sam_2, &key, + u3x_con_sam_3, &flags, 0) || + u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || + u3ud(key) || u3ud(flags)) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("blake3_chunk_output", _cqe_blake3_chunk_output(wid, dat, key, counter, flags)); + } + } + + static u3_atom + _cqe_blake3_compress(u3_atom cv, u3_atom counter, + u3_atom block, u3_atom block_len, u3_atom flags) + { + c3_y cv_y[32], block_y[64], out_y[64]; + u3r_bytes(0, 32, cv_y, cv); + u3r_bytes(0, 64, block_y, block); + urcrypt_blake3_compress(cv_y, block_y, block_len, counter, flags, out_y); + return u3i_bytes(64, out_y); + } + + u3_noun + u3we_blake3_compress(u3_noun cor) + { + u3_noun output = u3x_at(u3x_sam, cor); + u3_noun cv, counter, block, block_len, flags; // destructured output + + if ( u3r_quil(output, &cv, &counter, &block, &block_len, &flags) || + u3ud(cv) || u3ud(block) || u3ud(block_len) || u3ud(counter) || u3ud(flags)) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("blake3_compress", _cqe_blake3_compress(cv, counter, block, block_len, flags)); + } + } diff --git a/vere/pkg/noun/jets/e/bytestream.c b/vere/pkg/noun/jets/e/bytestream.c new file mode 100644 index 0000000..71761e1 --- /dev/null +++ b/vere/pkg/noun/jets/e/bytestream.c @@ -0,0 +1,1247 @@ +#include <types.h> +#include <imprison.h> +#include <jets/k.h> +#include <nock.h> +#include <retrieve.h> +#include <xtract.h> +#include <log.h> + +// XX do not crash on indirect atoms, but default to Hoon +// XX use u3i_word to imprison all indirect atoms +// +static void +_x_octs(u3_noun octs, u3_atom* p_octs, u3_atom* q_octs) { + + if (c3n == u3r_mean(octs, + 2, p_octs, + 3, q_octs, 0)){ + u3m_bail(c3__exit); + } + + if (c3n == u3a_is_atom(*p_octs) || + c3n == u3a_is_atom(*q_octs)) { + u3m_bail(c3__exit); + } +} +static c3_o +_x_octs_buffer(u3_atom* p_octs, u3_atom *q_octs, + c3_w* p_octs_w, c3_y** buf_y, + c3_w* len_w, c3_w* lead_w) +{ + if (c3n == u3r_safe_word(*p_octs, p_octs_w)) { + return c3n; + } + + *len_w = u3r_met(3, *q_octs); + + if (c3y == u3a_is_cat(*q_octs)) { + *buf_y = (c3_y*)q_octs; + } + else { + u3a_atom* ptr_a = u3a_to_ptr(*q_octs); + *buf_y = (c3_y*)ptr_a->buf_w; + } + + *lead_w = 0; + + if (*p_octs_w > *len_w) { + *lead_w = *p_octs_w - *len_w; + } + else { + *len_w = *p_octs_w; + } + + return c3y; +} + +u3_noun +_qe_bytestream_rip_octs(u3_atom p_octs, u3_atom q_octs) { + + c3_w p_octs_w, len_w, lead_w; + c3_y* buf_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &buf_y, + &len_w, &lead_w)){ + return u3_none; + } + + if (p_octs_w == 0) { + return u3_nul; + } + + u3_noun rip = u3_nul; + + while (lead_w--) { + rip = u3nc(0x0, rip); + } + + buf_y += len_w - 1; + + while (len_w--) { + rip = u3nc(*(buf_y--), rip); + } + + return rip; +} + +u3_noun +u3we_bytestream_rip_octs(u3_noun cor){ + + u3_noun sam = u3x_at(u3x_sam, cor); + + u3_atom p_octs, q_octs; + _x_octs(sam, &p_octs, &q_octs); + + return _qe_bytestream_rip_octs(p_octs, q_octs); + +} + +u3_noun +_qe_bytestream_cat_octs(u3_noun octs_a, u3_noun octs_b) { + + u3_atom p_octs_a, p_octs_b; + u3_atom q_octs_a, q_octs_b; + + _x_octs(octs_a, &p_octs_a, &q_octs_a); + _x_octs(octs_b, &p_octs_b, &q_octs_b); + + c3_w p_octs_a_w, p_octs_b_w; + c3_w len_w, lem_w; + c3_w lead_w, leaf_w; + + c3_y* sea_y; + c3_y* seb_y; + + if (c3n == _x_octs_buffer(&p_octs_a, &q_octs_a, + &p_octs_a_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + if (c3n == _x_octs_buffer(&p_octs_b, &q_octs_b, + &p_octs_b_w, &seb_y, + &lem_w, &leaf_w)) { + return u3_none; + } + + if (p_octs_a_w == 0) { + return u3k(octs_b); + } + + if (p_octs_b_w == 0) { + return u3k(octs_a); + } + + c3_d p_octs_d = p_octs_a_w + p_octs_b_w; + + u3_noun ret; + + // Both a and b are 0. + // + if (len_w == 0 && lem_w == 0) { + ret = u3nc(u3i_chub(p_octs_d), u3i_word(0)); + } + else { + u3i_slab sab_u; + + u3i_slab_bare(&sab_u, 3, (c3_d)p_octs_a_w + lem_w); + sab_u.buf_w[sab_u.len_w - 1] = 0; + + memcpy(sab_u.buf_y, sea_y, len_w); + memset(sab_u.buf_y + len_w, 0, lead_w); + memcpy(sab_u.buf_y + p_octs_a_w, seb_y, lem_w); + + u3_noun q_octs = u3i_slab_moot(&sab_u); + ret = u3nc(u3i_chub(p_octs_d), q_octs); + } + return ret; +} + +u3_noun +u3we_bytestream_cat_octs(u3_noun cor) { + + u3_noun octs_a, octs_b; + + u3x_mean(cor, u3x_sam_2, &octs_a, u3x_sam_3, &octs_b, 0); + + return _qe_bytestream_cat_octs(octs_a, octs_b); + +} + +u3_noun +_qe_bytestream_can_octs(u3_noun octs_list) { + + if (u3_nul == octs_list) { + return u3nc(0, 0); + } + + if (u3_nul == u3t(octs_list)) { + return u3k(u3h(octs_list)); + } + + /* We can octs in two steps: + * first loop iteration computes the total required + * buffer size in bytes, factoring in the leading bytes + * of the final octs. The second loop iterates over each octs, + * copying the data to the output buffer. + */ + + // Compute total size + // + c3_d tot_d = 0; + + u3_noun octs_list_start = octs_list; + u3_noun octs = u3_none; + // Last non-zero octs + u3_noun last_octs = u3_none; + + while (octs_list != u3_nul) { + + octs = u3h(octs_list); + + if (c3n == u3a_is_atom(u3h(octs)) || + c3n == u3a_is_atom(u3t(octs))) { + u3m_bail(c3__exit); + } + c3_w p_octs_w; + + if (c3n == u3r_safe_word(u3h(octs), &p_octs_w)) { + u3z(octs_list); + return u3_none; + } + // Check for overflow + // + if ( p_octs_w > (UINT64_MAX - tot_d)){ + return u3_none; + } + tot_d += p_octs_w; + + octs_list = u3t(octs_list); + } + + // Compute leading zeros of last non-zero octs -- the buffer + // size is decreased by this much. + // + // =leading-zeros (sub p.octs (met 3 q.octs)) + // + // p.octs fits into a word -- this has been verified + // in the loop above. + // + // The resulting buf_len_w is correct only if the last + // octs is non-zero: but at the return u3i_slab_mint + // takes care of trimming. + // + c3_w last_lead_w = (u3r_word(0, u3h(octs)) - u3r_met(3, u3t(octs))); + c3_d buf_len_w = tot_d - last_lead_w; + + if (buf_len_w == 0) { + return u3nc(u3i_word(tot_d), 0); + } + + u3i_slab sab_u; + u3i_slab_bare(&sab_u, 3, buf_len_w); + c3_y* buf_y = sab_u.buf_y; + + sab_u.buf_w[sab_u.len_w - 1] = 0; + + c3_y* sea_y; + u3_atom p_octs, q_octs; + c3_w p_octs_w, q_octs_w; + c3_w len_w, lead_w; + + // Bytes written so far + // + c3_d wit_d = 0; + + octs_list = octs_list_start; + + while (octs_list != u3_nul) { + + octs = u3h(octs_list); + + _x_octs(octs, &p_octs, &q_octs); + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)){ + return u3_none; + } + + if (p_octs_w == 0) { + octs_list = u3t(octs_list); + continue; + } + + memcpy(buf_y, sea_y, len_w); + buf_y += len_w; + wit_d += len_w; + + // More bytes to follow, write leading zeros + // + if (wit_d < buf_len_w) { + memset(buf_y, 0, lead_w); + buf_y += lead_w; + wit_d += lead_w; + } + + octs_list = u3t(octs_list); + } + + u3_assert((buf_y - sab_u.buf_y) == buf_len_w); + + return u3nc(u3i_chub(tot_d), u3i_slab_mint(&sab_u)); +} + +u3_noun +u3we_bytestream_can_octs(u3_noun cor) +{ + u3_noun octs_list; + + u3x_mean(cor, u3x_sam_1, &octs_list, 0); + + return _qe_bytestream_can_octs(octs_list); +} +u3_noun +_qe_bytestream_skip_line(u3_atom pos, u3_noun octs) +{ + c3_w pos_w; + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + while (pos_w < len_w) { + if (*(sea_y + pos_w) == '\n') { + break; + } + pos_w++; + } + // Newline not found, position at the end + if (*(sea_y + pos_w) != '\n') { + pos_w = p_octs; + } + else { + pos_w++; + } + + return u3nc(u3i_word(pos_w), u3k(octs)); +} +u3_noun +u3we_bytestream_skip_line(u3_noun cor) +{ + + u3_atom pos; + u3_noun octs; + + u3x_mean(cor, u3x_sam_2, &pos, u3x_sam_3, &octs, 0); + + return _qe_bytestream_skip_line(pos, octs); + +} +u3_noun +_qe_bytestream_find_byte(u3_atom bat, u3_atom pos, u3_noun octs) +{ + c3_w bat_w, pos_w; + + if (c3n == u3r_safe_word(bat, &bat_w) || bat_w > 0xff) { + return u3_none; + } + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + while (pos_w < len_w) { + + if (*(sea_y + pos_w) == bat_w) { + return u3nc(u3_nul, u3i_word(pos_w)); + } + + pos_w++; + } + // Here we are sure that: + // (1) bat_w has not been found + // (2) therefore pos_w == len_w + // + // If bat_w == 0, and there is still input + // in the stream, it means pos_w points at + // the first leading zero. + // + if (pos_w < p_octs && bat_w == 0) { + return u3nc(u3_nul, u3i_word(pos_w)); + } + + return u3_nul; +} +u3_noun +u3we_bytestream_find_byte(u3_noun cor) +{ + u3_atom bat; + u3_atom pos; + u3_noun octs; + + u3x_mean(cor, u3x_sam_2, &bat, + u3x_sam_6, &pos, + u3x_sam_7, &octs, 0); + + return _qe_bytestream_find_byte(bat, pos, octs); +} +u3_noun +_qe_bytestream_seek_byte(u3_atom bat, u3_atom pos, u3_noun octs) +{ + c3_w bat_w, pos_w; + + if (c3n == u3r_safe_word(bat, &bat_w) || bat_w > 0xff) { + return u3_none; + } + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + while (pos_w < len_w) { + + if (*(sea_y + pos_w) == bat_w) { + u3_noun idx = u3nc(u3_nul, u3i_word(pos_w)); + u3_noun new_bays = u3nc(u3i_word(pos_w), u3k(octs)); + return u3nc(idx, new_bays); + } + + pos_w++; + } + + // find leading zero: see comment in *_find_byte + // + if (pos_w < p_octs && bat_w == 0) { + u3_noun idx = u3nc(u3_nul, u3i_word(pos_w)); + u3_noun new_bays = u3nc(u3i_word(pos_w), u3k(octs)); + return u3nc(idx, new_bays); + } + + return u3nc(u3_nul, u3nc(u3k(pos), u3k(octs))); + +} +u3_noun +u3we_bytestream_seek_byte(u3_noun cor) +{ + u3_atom bat; + u3_atom pos; + u3_noun octs; + + u3x_mean(cor, u3x_sam_2, &bat, + u3x_sam_6, &pos, + u3x_sam_7, &octs, 0); + + return _qe_bytestream_seek_byte(bat, pos, octs); +} + +u3_noun +_qe_bytestream_read_byte(u3_atom pos, u3_noun octs) +{ + c3_w pos_w; + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + if (pos_w + 1 > p_octs_w) { + u3m_bail(c3__exit); + } + + c3_y bat_y; + + if (pos_w < len_w) { + bat_y = *(sea_y + pos_w); + } + else { + bat_y = 0; + } + + u3_noun new_bays = u3nc(u3i_word(pos_w + 1), u3k(octs)); + + return u3nc(bat_y, new_bays); +} + +u3_noun +u3we_bytestream_read_byte(u3_noun cor) +{ + u3_atom pos; + u3_noun octs; + + u3x_mean(cor, u3x_sam_2, &pos, + u3x_sam_3, &octs, 0); + + return _qe_bytestream_read_byte(pos, octs); +} + +u3_noun +_qe_bytestream_read_octs(u3_atom n, u3_atom pos, u3_noun octs) +{ + c3_w n_w, pos_w; + + if (c3n == u3r_safe_word(n, &n_w)) { + return u3_none; + } + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + if (n_w == 0) { + return u3nc(u3nc(0,0), u3nc(u3k(pos), u3k(octs))); + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + if (pos_w + n_w > p_octs_w) { + u3m_bail(c3__exit); + } + + // Number of bytes to read, excluding leading zeros + // + c3_w red_w = n_w; + + if (pos_w + n_w > len_w) { + if (pos_w < len_w) { + red_w = len_w - pos_w; + } + // leading zeros - nothing to read + // + else { + red_w = 0; + } + } + + u3_noun read_octs; + + if (red_w == 0) { + read_octs = u3nc(u3i_word(n_w), 0); + } + else { + u3i_slab sab_u; + u3i_slab_bare(&sab_u, 3, n_w); + sab_u.buf_w[sab_u.len_w - 1] = 0; + + memcpy(sab_u.buf_y, sea_y + pos_w, red_w); + + if (red_w < n_w) { + memset(sab_u.buf_y + red_w, 0, (n_w - red_w)); + } + + read_octs = u3nc(u3i_word(n_w), u3i_slab_moot(&sab_u)); + } + + u3_noun new_bays = u3nc(u3i_word(pos_w + n_w), u3k(octs)); + + return u3nc(read_octs, new_bays); +} + +u3_noun +u3we_bytestream_read_octs(u3_noun cor) +{ + u3_atom n; + u3_atom pos; + u3_noun octs; + + u3x_mean(cor, u3x_sam_2, &n, + u3x_sam_6, &pos, + u3x_sam_7, &octs, 0); + + return _qe_bytestream_read_octs(n, pos, octs); +} + + +u3_noun +_qe_peek_octs(c3_w n_w, c3_w pos_w, c3_w p_octs_w, c3_y* sea_y, + c3_w len_w) +{ + if (n_w == 0) { + return u3nc(0, 0); + } + + if (pos_w + n_w > p_octs_w) { + return u3m_bail(c3__exit); + } + + // Read leading zeros only + // + if (pos_w >= len_w) { + return u3nc(u3i_word(n_w), 0); + } + // Number of remaining buffer bytes + c3_w reb_w = len_w - pos_w; + + u3i_slab sab_u; + c3_w my_len_w; + + if (n_w < reb_w) { + my_len_w = n_w; + } + else { + my_len_w = reb_w; + } + u3i_slab_bare(&sab_u, 3, my_len_w); + sab_u.buf_w[sab_u.len_w - 1] = 0; + memcpy(sab_u.buf_y, sea_y + pos_w, my_len_w); + + return u3nc(u3i_word(n_w), u3i_slab_moot(&sab_u)); +} +u3_noun _qe_bytestream_chunk(u3_atom size, u3_noun pos, u3_noun octs) +{ + c3_w size_w, pos_w; + + if (c3n == u3r_safe_word(size, &size_w)) { + return u3_none; + } + + if (size_w == 0) { + return u3_nul; + } + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + u3_noun hun = u3_nul; + + while (pos_w < p_octs) { + // Remaining bytes + // + c3_w rem = (p_octs - pos_w); + + if (rem < size) { + u3_noun octs = _qe_peek_octs(rem, pos_w, p_octs_w, sea_y, + len_w); + hun = u3nc(octs, hun); + pos_w += rem; + } + else { + u3_noun octs = _qe_peek_octs(size, pos_w, p_octs_w, sea_y, + len_w); + hun = u3nc(octs, hun); + pos_w += size; + } + } + + return u3kb_flop(hun); +} + +u3_noun +u3we_bytestream_chunk(u3_noun cor) +{ + u3_atom size; + u3_atom pos; + u3_noun octs; + + u3x_mean(cor, u3x_sam_2, &size, + u3x_sam_6, &pos, + u3x_sam_7, &octs, 0); + + return _qe_bytestream_chunk(size, pos, octs); +} + +u3_noun +_qe_bytestream_extract(u3_noun sea, u3_noun rac) +{ + u3_atom pos; + u3_noun octs; + + u3x_mean(sea, 2, &pos, 3, &octs, 0); + + c3_w pos_w; + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + u3_noun dal = u3_nul; + + u3_noun new_sea = u3_none; + + while (pos_w < p_octs_w) { + new_sea = u3nc(u3i_word(pos_w), u3k(octs)); + u3_noun ext = u3x_good(u3n_slam_on(u3k(rac), new_sea)); + + u3_atom sip, ken; + c3_w sip_w, ken_w; + + u3x_mean(ext, 2, &sip, 3, &ken, 0); + + if (c3n == u3r_safe_word(sip, &sip_w)) { + // XX is u3z necessary here? + // does memory get freed on bail? + // + u3l_log("bytestream: sip fail"); + u3z(dal); + u3z(ext); + return u3_none; + } + + if (c3n == u3r_safe_word(ken, &ken_w)) { + u3l_log("bytestream: ken fail"); + u3z(dal); + u3z(ext); + return u3_none; + } + + u3z(ext); + + if (sip_w == 0 && ken_w == 0) { + break; + } + + if (pos_w + sip_w > p_octs_w) { + u3z(dal); + return u3_none; + } + + pos_w += sip_w; + + if (ken_w == 0) { + continue; + } + + u3_noun octs = _qe_peek_octs(ken_w, pos_w, p_octs_w, sea_y, len_w); + pos_w += ken_w; + dal = u3nc(octs, dal); + } + + new_sea = u3nc(u3i_word(pos_w), u3k(octs)); + + return u3nc(u3kb_flop(dal), new_sea); +} +u3_noun +u3we_bytestream_extract(u3_noun cor) +{ + u3_noun sea; + u3_noun rac; + + u3x_mean(cor, u3x_sam_2, &sea, + u3x_sam_3, &rac, 0); + + return _qe_bytestream_extract(sea, rac); +} + +u3_noun +_qe_bytestream_fuse_extract(u3_noun sea, u3_noun rac) +{ + u3_atom pos; + u3_noun octs; + + u3x_mean(sea, 2, &pos, 3, &octs, 0); + + c3_w pos_w; + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + u3_noun dal = u3_nul; + + u3_noun new_sea = u3_none; + + while (pos_w < p_octs_w) { + new_sea = u3nc(u3i_word(pos_w), u3k(octs)); + u3_noun ext = u3x_good(u3n_slam_on(u3k(rac), new_sea)); + + u3_atom sip, ken; + c3_w sip_w, ken_w; + + u3x_mean(ext, 2, &sip, 3, &ken, 0); + + if (c3n == u3r_safe_word(sip, &sip_w)) { + // XX is u3z necessary here? + // does memory get freed on bail? + // + u3l_log("bytestream: sip fail"); + u3z(dal); + u3z(ext); + return u3_none; + } + if (c3n == u3r_safe_word(ken, &ken_w)) { + u3l_log("bytestream: ken fail"); + u3z(dal); + u3z(ext); + return u3_none; + } + + u3z(ext); + + if (sip_w == 0 && ken_w == 0) { + break; + } + + if (pos_w + sip_w > p_octs_w) { + u3z(dal); + return u3_none; + } + + pos_w += sip_w; + + if (ken_w == 0) { + continue; + } + + u3_noun octs = _qe_peek_octs(ken_w, pos_w, p_octs_w, sea_y, len_w); + pos_w += ken_w; + dal = u3nc(octs, dal); + } + + u3_noun lad = u3kb_flop(dal); + u3_noun data = _qe_bytestream_can_octs(lad); + u3z(lad); + + new_sea = u3nc(u3i_word(pos_w), u3k(octs)); + + return u3nc(data, new_sea); +} + +u3_noun +u3we_bytestream_fuse_extract(u3_noun cor) +{ + u3_noun sea; + u3_noun rac; + + u3x_mean(cor, u3x_sam_2, &sea, + u3x_sam_3, &rac, 0); + + return _qe_bytestream_fuse_extract(sea, rac); +} + +#define BITS_D (sizeof(c3_d)*8) + +u3_noun +_qe_bytestream_need_bits(u3_atom n, u3_noun bits) +{ + u3_atom num, bit; + u3_noun bays; + + u3x_mean(bits, 2, &num, + 6, &bit, + 7, &bays, 0); + + + c3_w n_w, num_w; + c3_d bit_d; + + if (c3n == u3r_safe_word(n, &n_w)) { + return u3_none; + } + if (c3n == u3r_safe_word(num, &num_w)) { + return u3_none; + } + if (c3n == u3r_safe_chub(bit, &bit_d)) { + return u3_none; + } + + if (num_w >= n_w) { + return u3k(bits); + } + + // How many bytes to read + // + c3_w need_bits_w = n_w - num_w; + + // Requires indirect atom, drop to Hoon + // + if (need_bits_w > BITS_D) { + return u3_none; + } + + c3_w need_bytes_w = need_bits_w / 8; + + if (need_bits_w % 8) { + need_bytes_w += 1; + } + + c3_w pos_w; + u3_atom pos; + u3_noun octs; + + + u3x_mean(bays, 2, &pos, 3, &octs, 0); + + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + u3_atom p_octs, q_octs; + + _x_octs(octs, &p_octs, &q_octs); + + c3_w p_octs_w; + c3_w len_w, lead_w; + + c3_y* sea_y; + + if (c3n == _x_octs_buffer(&p_octs, &q_octs, + &p_octs_w, &sea_y, + &len_w, &lead_w)) { + return u3_none; + } + + if (pos_w + need_bytes_w > p_octs_w) { + u3m_bail(c3__exit); + } + + while (need_bytes_w--) { + + if (pos_w < len_w) { + bit_d += *(sea_y + pos_w) << num_w; + } + num_w += 8; + pos_w++; + + u3_assert(num_w <= BITS_D); + } + + u3_noun new_bays = u3nc(u3i_word(pos_w), u3k(octs)); + + return u3nt(u3i_word(num_w), u3i_chub(bit_d), new_bays); +} +// +$ bits $+ bits +// $: num=@ud +// bit=@ub +// =bays +// == +u3_noun +u3we_bytestream_need_bits(u3_noun cor) +{ + u3_atom n; + u3_noun bits; + + u3x_mean(cor, u3x_sam_2, &n, + u3x_sam_3, &bits, 0); + + return _qe_bytestream_need_bits(n, bits); +} + +u3_noun +_qe_bytestream_drop_bits(u3_atom n, u3_noun bits) +{ + + u3_atom num, bit; + u3_noun bays; + + u3x_mean(bits, 2, &num, + 6, &bit, + 7, &bays, 0); + + c3_w n_w, num_w; + c3_d bit_d; + + if (c3n == u3r_safe_word(n, &n_w)) { + return u3_none; + } + if (c3n == u3r_safe_word(num, &num_w)) { + return u3_none; + } + if (c3n == u3r_safe_chub(bit, &bit_d)) { + return u3_none; + } + + if(n_w == 0) { + return u3k(bits); + } + + c3_w dop_w = n_w; + + if (dop_w > num_w) { + dop_w = num_w; + } + + bit_d >>= dop_w; + num_w -= dop_w; + + return u3nt(u3i_word(num_w), u3i_chub(bit_d), u3k(bays)); +} +u3_noun +u3we_bytestream_drop_bits(u3_noun cor) +{ + u3_atom n; + u3_noun bits; + + u3x_mean(cor, u3x_sam_2, &n, + u3x_sam_3, &bits, 0); + + return _qe_bytestream_drop_bits(n, bits); +} + +u3_noun +_qe_bytestream_peek_bits(u3_atom n, u3_noun bits) +{ + + u3_atom num, bit; + u3_noun bays; + + u3x_mean(bits, 2, &num, + 6, &bit, + 7, &bays, 0); + + c3_w n_w, num_w; + c3_d bit_d; + + if (c3n == u3r_safe_word(n, &n_w)) { + return u3_none; + } + if (c3n == u3r_safe_word(num, &num_w)) { + return u3_none; + } + if (c3n == u3r_safe_chub(bit, &bit_d)) { + return u3_none; + } + + if (n_w == 0) { + return u3i_word(0); + } + + if (n_w > num_w) { + u3m_bail(c3__exit); + } + + if (n_w > BITS_D) { + return u3_none; + } + + if (n_w == BITS_D) { + return u3i_chub(bit_d); + } + else { + c3_d mak_d = ((c3_d)1 << n_w) - 1; + + return u3i_chub(bit_d & mak_d); + } +} +u3_noun +u3we_bytestream_peek_bits(u3_noun cor) +{ + u3_atom n; + u3_noun bits; + + u3x_mean(cor, u3x_sam_2, &n, + u3x_sam_3, &bits, 0); + + return _qe_bytestream_peek_bits(n, bits); +} + +u3_noun +_qe_bytestream_read_bits(u3_atom n, u3_noun bits) +{ + + u3_atom num, bit; + u3_noun bays; + + u3x_mean(bits, 2, &num, + 6, &bit, + 7, &bays, 0); + + c3_w n_w, num_w; + c3_d bit_d; + + if (c3n == u3r_safe_word(n, &n_w)) { + return u3_none; + } + if (c3n == u3r_safe_word(num, &num_w)) { + return u3_none; + } + if (c3n == u3r_safe_chub(bit, &bit_d)) { + return u3_none; + } + + if (n_w > num_w) { + u3m_bail(c3__exit); + } + + if (n_w > BITS_D) { + return u3_none; + } + + c3_d bet_d = 0; + + if (n_w == BITS_D) { + bet_d = bit_d; + } + else { + c3_d mak_d = ((c3_d)1 << n_w) - 1; + bet_d = bit_d & mak_d; + } + + bit_d >>= n_w; + num_w -= n_w; + + u3_noun new_bits = u3nt(u3i_word(num_w), u3i_chub(bit_d), u3k(bays)); + + return u3nc(u3i_chub(bet_d), new_bits); +} + +u3_noun +u3we_bytestream_read_bits(u3_noun cor) +{ + u3_atom n; + u3_noun bits; + + u3x_mean(cor, u3x_sam_2, &n, + u3x_sam_3, &bits, 0); + + return _qe_bytestream_read_bits(n, bits); +} + +u3_noun +_qe_bytestream_byte_bits(u3_noun bits) +{ + + u3_atom num, bit; + u3_noun bays; + + u3x_mean(bits, 2, &num, + 6, &bit, + 7, &bays, 0); + + c3_w num_w; + c3_d bit_d; + + if (c3n == u3r_safe_word(num, &num_w)) { + return u3_none; + } + if (c3n == u3r_safe_chub(bit, &bit_d)) { + return u3_none; + } + + c3_y rem_y = num_w & 0x7; + + if (rem_y == 0) { + return u3k(bits); + } + + u3_noun new_bits = u3nt(u3i_word(num_w - rem_y), + u3i_chub(bit_d >> rem_y), + u3k(bays)); + + return new_bits; +} + +u3_noun +u3we_bytestream_byte_bits(u3_noun cor) +{ + u3_noun bits; + + u3x_mean(cor, u3x_sam, &bits, 0); + + return _qe_bytestream_byte_bits(bits); +} diff --git a/vere/pkg/noun/jets/e/chacha.c b/vere/pkg/noun/jets/e/chacha.c new file mode 100644 index 0000000..e42f8e2 --- /dev/null +++ b/vere/pkg/noun/jets/e/chacha.c @@ -0,0 +1,74 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqe_chacha_crypt(u3_atom rounds, u3_atom key, u3_atom nonce, u3_atom counter, u3_atom wid, u3_atom dat) + { + c3_w rounds_w, wid_w; + c3_d counter_d; + if ( !u3r_word_fit(&rounds_w, rounds) || !u3r_word_fit(&wid_w, wid) || c3n == u3r_safe_chub(counter, &counter_d) ) { + return u3m_bail(c3__fail); + } + else { + c3_y key_y[32], nonce_y[8]; + u3r_bytes(0, 32, key_y, key); + u3r_bytes(0, 8, nonce_y, nonce); + c3_y *dat_y = u3r_bytes_alloc(0, wid_w, dat); + urcrypt_chacha_crypt(rounds_w, key_y, nonce_y, counter_d, wid_w, dat_y); + u3_noun cry = u3i_bytes(wid_w, dat_y); + u3a_free(dat_y); + return u3i_cell(wid, cry); + } + } + + u3_noun + u3we_chacha_crypt(u3_noun cor) + { + u3_noun sam = u3x_at(u3x_sam, cor); + u3_noun rounds, key, nonce, counter, msg; + u3_noun wid, dat; + + if ( u3r_quil(sam, &rounds, &key, &nonce, &counter, &msg) || + u3ud(rounds) || u3ud(key) || u3ud(nonce) || u3ud(counter) || u3r_cell(msg, &wid, &dat) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("chacha_crypt", _cqe_chacha_crypt(rounds, key, nonce, counter, wid, dat)); + } + } + + + static u3_noun + _cqe_chacha_xchacha(u3_atom rounds, u3_atom key, u3_atom nonce) + { + c3_w rounds_w; + if ( !u3r_word_fit(&rounds_w, rounds) ) { + return u3m_bail(c3__fail); + } + c3_y key_y[32], nonce_y[64], xkey_y[32], xnonce_y[8]; + u3r_bytes(0, 32, key_y, key); + u3r_bytes(0, 24, nonce_y, nonce); + urcrypt_chacha_xchacha(rounds, key_y, nonce_y, xkey_y, xnonce_y); + return u3i_cell(u3i_bytes(32, xkey_y), u3i_bytes(8, xnonce_y)); + } + + u3_noun + u3we_chacha_xchacha(u3_noun cor) + { + u3_noun sam = u3x_at(u3x_sam, cor); + u3_noun rounds, key, nonce; + if ( c3n == u3r_trel(sam, &rounds, &key, &nonce) || + c3n == u3ud(rounds) || + c3n == u3ud(key) || + c3n == u3ud(nonce) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("chacha_xchacha", _cqe_chacha_xchacha(rounds, key, nonce)); + } + } diff --git a/vere/pkg/noun/jets/e/crc.c b/vere/pkg/noun/jets/e/crc.c new file mode 100644 index 0000000..496b8d5 --- /dev/null +++ b/vere/pkg/noun/jets/e/crc.c @@ -0,0 +1,59 @@ +/// @file + +#include <stdio.h> +#include <allocate.h> +#include "zlib.h" + +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qe_crc32(u3_noun input_octs) +{ + u3_atom head = u3h(input_octs); + u3_atom tail = u3t(input_octs); + c3_w tel_w = u3r_met(3, tail); + c3_w hed_w; + if ( c3n == u3r_safe_word(head, &hed_w) ) { + return u3m_bail(c3__fail); + } + c3_y* input; + + if (c3y == u3a_is_cat(tail)) { + input = (c3_y*)&tail; + } + else { + u3a_atom* vat_u = u3a_to_ptr(tail); + input = (c3_y*)vat_u->buf_w; + } + + if ( tel_w > hed_w ) { + return u3m_error("subtract-underflow"); + } + + c3_w led_w = hed_w - tel_w; + c3_w crc_w = 0; + + crc_w = crc32(crc_w, input, tel_w); + + while ( led_w > 0 ) { + c3_y byt_y = 0; + crc_w = crc32(crc_w, &byt_y, 1); + led_w--; + } + + return u3i_word(crc_w); +} + +u3_noun +u3we_crc32(u3_noun cor) +{ + u3_noun a = u3r_at(u3x_sam, cor); + + if ( (u3du(a) == c3y) && (u3ud(u3h(a)) == c3y) && (u3ud(u3t(a)) == c3y) ) { + return u3qe_crc32(a); + } else { + return u3m_bail(c3__exit); + } +} diff --git a/vere/pkg/noun/jets/e/cue.c b/vere/pkg/noun/jets/e/cue.c new file mode 100644 index 0000000..643b408 --- /dev/null +++ b/vere/pkg/noun/jets/e/cue.c @@ -0,0 +1,27 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qe_cue(u3_atom a) +{ + return u3s_cue_atom(a); +} + +u3_noun +u3we_cue(u3_noun cor) +{ + return u3qe_cue(u3x_atom(u3x_at(u3x_sam, cor))); +} + +u3_noun +u3ke_cue(u3_atom a) +{ + u3_noun b = u3qe_cue(a); + u3z(a); + return b; +} diff --git a/vere/pkg/noun/jets/e/ed_add_double_scalarmult.c b/vere/pkg/noun/jets/e/ed_add_double_scalarmult.c new file mode 100644 index 0000000..6512919 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -0,0 +1,72 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_add_double_scalarmult(u3_atom a, + u3_atom a_point, + u3_atom b, + u3_atom b_point) + { + c3_y a_y[32], a_point_y[32], + b_y[32], b_point_y[32], + out_y[32]; + c3_w met_w; + + met_w = u3r_met(3, a); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, a)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + met_w = u3r_met(3, b); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, b)) ) + ) { + u3_noun b_recs = u3qee_recs(b); + u3r_bytes(0, 32, b_y, b_recs); + u3z(b_recs); + } else { + u3r_bytes(0, 32, b_y, b); + } + + if ( (0 != u3r_bytes_fit(32, a_point_y, a_point)) || + (0 != u3r_bytes_fit(32, b_point_y, b_point)) || + (0 != urcrypt_ed_add_double_scalarmult(a_y, a_point_y, b_y, b_point_y, out_y)) ) { + return u3m_bail(c3__exit); + } + else { + return u3i_bytes(32, out_y); + } + } + + u3_noun + u3wee_add_double_scalarmult(u3_noun cor) + { + u3_noun a, b, c, d; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_6, &b, + u3x_sam_14, &c, + u3x_sam_15, &d, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) || + (c3n == u3ud(d)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_add_double_scalarmult(a, b, c, d); + } + } diff --git a/vere/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/vere/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c new file mode 100644 index 0000000..39eda53 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -0,0 +1,66 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_add_scalarmult_scalarmult_base(u3_atom a, + u3_atom a_point, + u3_atom b) + { + c3_y a_y[32], a_point_y[32], b_y[32], out_y[32]; + c3_w met_w; + + met_w = u3r_met(3, a); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, a)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + met_w = u3r_met(3, b); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, b)) ) + ) { + u3_noun b_recs = u3qee_recs(b); + u3r_bytes(0, 32, b_y, b_recs); + u3z(b_recs); + } else { + u3r_bytes(0, 32, b_y, b); + } + + if ( (0 != u3r_bytes_fit(32, a_point_y, a_point)) || + (0 != urcrypt_ed_add_scalarmult_scalarmult_base(a_y, a_point_y, b_y, out_y)) ) { + return u3m_bail(c3__exit); + } + else { + return u3i_bytes(32, out_y); + } + } + + u3_noun + u3wee_add_scalarmult_scalarmult_base(u3_noun cor) + { + u3_noun a, b, c; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_6, &b, + u3x_sam_7, &c, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_add_scalarmult_scalarmult_base(a, b, c); + } + } diff --git a/vere/pkg/noun/jets/e/ed_luck.c b/vere/pkg/noun/jets/e/ed_luck.c new file mode 100644 index 0000000..c21889e --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_luck.c @@ -0,0 +1,37 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_luck(u3_atom sed) + { + c3_y sed_y[32]; + + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + c3_y pub_y[32]; + c3_y sec_y[64]; + urcrypt_ed_luck(sed_y, pub_y, sec_y); + return u3nc(u3i_bytes(32, pub_y), u3i_bytes(64, sec_y)); + } + } + + u3_noun + u3wee_luck(u3_noun cor) + { + u3_noun a = u3r_at(u3x_sam, cor); + + if ( (u3_none == a) || (c3n == u3ud(a)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_luck(a); + } + } diff --git a/vere/pkg/noun/jets/e/ed_point_add.c b/vere/pkg/noun/jets/e/ed_point_add.c new file mode 100644 index 0000000..70fe563 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_point_add.c @@ -0,0 +1,40 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + + static u3_atom + _cqee_point_add(u3_atom a, + u3_atom b) + { + c3_y a_y[32], b_y[32], out_y[32]; + + if ( (0 != u3r_bytes_fit(32, a_y, a)) || + (0 != u3r_bytes_fit(32, b_y, b)) || + (0 != urcrypt_ed_point_add(a_y, b_y, out_y)) ) { + return u3m_bail(c3__exit); + } + else { + return u3i_bytes(32, out_y); + } + } + + u3_noun + u3wee_point_add(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_point_add(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/ed_point_neg.c b/vere/pkg/noun/jets/e/ed_point_neg.c new file mode 100644 index 0000000..5a1a5bd --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_point_neg.c @@ -0,0 +1,37 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + + static u3_atom + _cqee_point_neg(u3_atom a) + { + c3_y a_y[32]; + + if ( (0 != u3r_bytes_fit(32, a_y, a)) || + (0 != urcrypt_ed_point_neg(a_y)) ) { + return u3m_bail(c3__exit); + } + else { + return u3i_bytes(32, a_y); + } + } + + u3_noun + u3wee_point_neg(u3_noun cor) + { + + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_point_neg(a); + } + } diff --git a/vere/pkg/noun/jets/e/ed_puck.c b/vere/pkg/noun/jets/e/ed_puck.c new file mode 100644 index 0000000..98581d7 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_puck.c @@ -0,0 +1,36 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_puck(u3_atom sed) + { + c3_y sed_y[32]; + + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + c3_y pub_y[32]; + urcrypt_ed_puck(sed_y, pub_y); + return u3i_bytes(32, pub_y); + } + } + + u3_noun + u3wee_puck(u3_noun cor) + { + u3_noun a = u3r_at(u3x_sam, cor); + + if ( (u3_none == a) || (c3n == u3ud(a)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_puck(a); + } + } diff --git a/vere/pkg/noun/jets/e/ed_recs.c b/vere/pkg/noun/jets/e/ed_recs.c new file mode 100644 index 0000000..bdcf224 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_recs.c @@ -0,0 +1,48 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + // `@ux`(rev 3 32 l:ed:crypto) + static c3_y _cqee_l_prime[] = { + 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, + 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + }; + + u3_atom + u3qee_recs(u3_atom a) + { + c3_w met_w = u3r_met(3, a); + + if ( 64 < met_w ) { + u3_atom l_prime = u3i_bytes(32, _cqee_l_prime); + u3_atom pro = u3qa_mod(a, l_prime); + u3z(l_prime); + return pro; + } + + c3_y a_y[64]; + + u3r_bytes(0, 64, a_y, a); + urcrypt_ed_scalar_reduce(a_y); + return u3i_bytes(32, a_y); + } + + u3_noun + u3wee_recs(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qee_recs(a); + } + } diff --git a/vere/pkg/noun/jets/e/ed_scad.c b/vere/pkg/noun/jets/e/ed_scad.c new file mode 100644 index 0000000..af95563 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_scad.c @@ -0,0 +1,124 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_scad(u3_atom pub, u3_atom sek, u3_atom sca) + { + c3_y pub_y[32]; + c3_y sek_y[64]; + c3_y sca_y[32]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(32, sca_y, sca) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + urcrypt_ed_add_scalar_public_private(pub_y, sek_y, sca_y); + return u3nc(u3i_bytes(32, pub_y), u3i_bytes(64, sek_y)); + } + } + + u3_noun + u3wee_scad(u3_noun cor) + { + u3_noun pub, sek, sca; + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &pub, + u3x_sam_6, &sek, + u3x_sam_7, &sca, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sek)) || + (c3n == u3ud(sca)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scad(pub, sek, sca); + } + } + + static u3_atom + _cqee_scas(u3_atom sek, u3_atom sca) + { + c3_y sek_y[64]; + c3_y sca_y[32]; + + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(32, sca_y, sca) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + urcrypt_ed_add_scalar_private(sek_y, sca_y); + return u3i_bytes(64, sek_y); + } + } + + u3_noun + u3wee_scas(u3_noun cor) + { + u3_noun sek, sca; + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &sek, + u3x_sam_3, &sca, 0)) || + (c3n == u3ud(sek)) || + (c3n == u3ud(sca)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scas(sek, sca); + } + } + + static u3_atom + _cqee_scap(u3_atom pub, u3_atom sca) + { + c3_y pub_y[32]; + c3_y sca_y[32]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(32, sca_y, sca) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + urcrypt_ed_add_scalar_public(pub_y, sca_y); + return u3i_bytes(32, pub_y); + } + } + + u3_noun + u3wee_scap(u3_noun cor) + { + u3_noun pub, sca; + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &pub, + u3x_sam_3, &sca, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sca)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scap(pub, sca); + } + } + + diff --git a/vere/pkg/noun/jets/e/ed_scalarmult.c b/vere/pkg/noun/jets/e/ed_scalarmult.c new file mode 100644 index 0000000..8585c29 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_scalarmult.c @@ -0,0 +1,54 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_scalarmult(u3_atom a, + u3_atom b) + { + c3_y a_y[32], b_y[32], out_y[32]; + if (0 != u3r_bytes_fit(32, b_y, b)) { + return u3m_bail(c3__exit); + } + + c3_w met_w = u3r_met(3, a); + // scalarmult expects a_y[31] <= 127 + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, a)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + if ( (0 != urcrypt_ed_scalarmult(a_y, b_y, out_y)) ) { + // at this point, will only fail if b is bad point + return u3m_bail(c3__exit); + } + else { + return u3i_bytes(32, out_y); + } + } + + u3_noun + u3wee_scalarmult(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_scalarmult(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/ed_scalarmult_base.c b/vere/pkg/noun/jets/e/ed_scalarmult_base.c new file mode 100644 index 0000000..6193584 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_scalarmult_base.c @@ -0,0 +1,46 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_scalarmult_base(u3_atom a) + { + c3_y a_y[32], out_y[32]; + c3_w met_w = u3r_met(3, a); + // scalarmult_base expects a_y[31] <= 127 + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, a)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + if (0 != urcrypt_ed_scalarmult_base(a_y, out_y)) { + // should be unreachable, as scalar already reduced + return u3m_bail(c3__exit); + } + else { + return u3i_bytes(32, out_y); + } + } + + u3_noun + u3wee_scalarmult_base(u3_noun cor) + { + u3_noun a = u3r_at(u3x_sam, cor); + + if ( (u3_none == a) || (c3n == u3ud(a)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scalarmult_base(a); + } + } diff --git a/vere/pkg/noun/jets/e/ed_shar.c b/vere/pkg/noun/jets/e/ed_shar.c new file mode 100644 index 0000000..ed293f7 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_shar.c @@ -0,0 +1,74 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_shar(u3_atom pub, u3_atom sed) + { + c3_y pub_y[32], sed_y[32]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + return u3m_bail(c3__exit); + } + else if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon calls luck, which crashes + return u3m_bail(c3__exit); + } + else { + c3_y shr_y[32]; + urcrypt_ed_shar(pub_y, sed_y, shr_y); + return u3i_bytes(32, shr_y); + } + } + + u3_noun + u3wee_shar(u3_noun cor) + { + u3_noun pub, sed; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sed, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sed)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_shar(pub, sed); + } + } + + static u3_atom + _cqee_slar(u3_atom pub, u3_atom sek) + { + c3_y pub_y[32], sek_y[64]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + return u3m_bail(c3__exit); + } + else if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + return u3m_bail(c3__exit); + } + else { + c3_y shr_y[32]; + urcrypt_ed_slar(pub_y, sek_y, shr_y); + return u3i_bytes(32, shr_y); + } + } + + u3_noun + u3wee_slar(u3_noun cor) + { + u3_noun pub, sek; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sek, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sek)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_slar(pub, sek); + } + } diff --git a/vere/pkg/noun/jets/e/ed_sign.c b/vere/pkg/noun/jets/e/ed_sign.c new file mode 100644 index 0000000..cd1797d --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_sign.c @@ -0,0 +1,166 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" +#include <retrieve.h> +#include <types.h> + + static u3_atom + _cqee_sign_octs(u3_noun len, u3_noun dat, u3_noun sed) + { + c3_y sed_y[32]; + c3_w len_w; + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon calls luck, which crashes + return u3m_bail(c3__exit); + } + else if ( !u3r_word_fit(&len_w, len) ) { + return u3m_bail(c3__fail); + } + else { + c3_y sig_y[64]; + c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); + urcrypt_ed_sign(dat_y, len_w, sed_y, sig_y); + u3a_free(dat_y); + return u3i_bytes(64, sig_y); + } + } + + u3_noun + u3wee_sign_octs(u3_noun cor) + { + u3_noun msg, sed; + u3_noun len, dat; + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + c3n == u3r_cell(msg, &len, &dat) || + c3n == u3ud(sed) || + c3n == u3ud(len) || + c3n == u3ud(dat) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_sign_octs(len, dat, sed); + } + } + + static u3_atom + _cqee_sign_octs_raw(u3_noun len, u3_noun dat, u3_noun pub, u3_noun sek) + { + c3_y pub_y[32], sek_y[64]; + c3_w len_w; + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon asserts size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon asserts size + return u3m_bail(c3__exit); + } + else if ( !u3r_word_fit(&len_w, len) ) { + return u3m_bail(c3__fail); + } + else { + c3_y sig_y[64]; + c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); + urcrypt_ed_sign_raw(dat_y, len_w, pub_y, sek_y, sig_y); + u3a_free(dat_y); + return u3i_bytes(64, sig_y); + } + } + + u3_noun + u3wee_sign_octs_raw(u3_noun cor) + { + u3_noun msg, pub, sek; + u3_noun len, dat; + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || + c3n == u3r_cell(msg, &len, &dat) || + c3n == u3ud(pub) || + c3n == u3ud(sek) || + c3n == u3ud(len) || + c3n == u3ud(dat) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_sign_octs_raw(len, dat, pub, sek); + } + } + + static u3_atom + _cqee_sign(u3_noun msg, + u3_noun sed) + { + c3_y sed_y[32]; + + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon calls luck, which crashes + return u3m_bail(c3__exit); + } + else { + c3_y sig_y[64]; + c3_w met_w; + c3_y* msg_y = u3r_bytes_all(&met_w, msg); + + urcrypt_ed_sign(msg_y, met_w, sed_y, sig_y); + u3a_free(msg_y); + + return u3i_bytes(64, sig_y); + } + } + + u3_noun + u3wee_sign(u3_noun cor) + { + u3_noun msg, sed; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + c3n == u3ud(msg) || + c3n == u3ud(sed) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_sign(msg, sed); + } + } + + static u3_atom + _cqee_sign_raw(u3_noun msg, + u3_noun pub, + u3_noun sek) + { + c3_y pub_y[32], sek_y[64]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon asserts size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon asserts size + return u3m_bail(c3__exit); + } + else { + c3_y sig_y[64]; + c3_w met_w; + c3_y* msg_y = u3r_bytes_all(&met_w, msg); + + urcrypt_ed_sign_raw(msg_y, met_w, pub_y, sek_y, sig_y); + u3a_free(msg_y); + + return u3i_bytes(64, sig_y); + } + } + + u3_noun + u3wee_sign_raw(u3_noun cor) + { + u3_noun msg, pub, sek; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || + c3n == u3ud(msg) || + c3n == u3ud(pub) || + c3n == u3ud(sek) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_sign_raw(msg, pub, sek); + } + } diff --git a/vere/pkg/noun/jets/e/ed_smac.c b/vere/pkg/noun/jets/e/ed_smac.c new file mode 100644 index 0000000..ce0ffac --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_smac.c @@ -0,0 +1,73 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_smac(u3_atom a, + u3_atom b, + u3_atom c) + { + c3_y a_y[32], b_y[32], c_y[32], out_y[32]; + c3_w met_w; + + met_w = u3r_met(3, a); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, a)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + met_w = u3r_met(3, b); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, b)) ) + ) { + u3_noun b_recs = u3qee_recs(b); + u3r_bytes(0, 32, b_y, b_recs); + u3z(b_recs); + } else { + u3r_bytes(0, 32, b_y, b); + } + + met_w = u3r_met(3, c); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(31, c)) ) + ) { + u3_noun c_recs = u3qee_recs(c); + u3r_bytes(0, 32, c_y, c_recs); + u3z(c_recs); + } else { + u3r_bytes(0, 32, c_y, c); + } + + urcrypt_ed_scalar_muladd(a_y, b_y, c_y, out_y); + return u3i_bytes(32, out_y); + } + + u3_noun + u3wee_smac(u3_noun cor) + { + u3_noun a, b, c; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_6, &b, + u3x_sam_7, &c, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqee_smac(a, b, c); + } + } diff --git a/vere/pkg/noun/jets/e/ed_veri.c b/vere/pkg/noun/jets/e/ed_veri.c new file mode 100644 index 0000000..6d7b750 --- /dev/null +++ b/vere/pkg/noun/jets/e/ed_veri.c @@ -0,0 +1,85 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_veri_octs(u3_noun sig, + u3_noun len, + u3_noun dat, + u3_noun pub) + { + c3_y sig_y[64], pub_y[32]; + c3_w len_w; + if ( (0 != u3r_bytes_fit(64, sig_y, sig)) || + (0 != u3r_bytes_fit(32, pub_y, pub)) || + !u3r_word_fit(&len_w, len) ) { + return c3n; + } + else { + c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); + c3_t val_t = urcrypt_ed_veri(dat_y, len_w, pub_y, sig_y); + u3a_free(dat_y); + + return val_t ? c3y : c3n; + } + } + + u3_noun + u3wee_veri_octs(u3_noun cor) + { + u3_noun sig, msg, pub; + u3_noun len, dat; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &sig, u3x_sam_6, &msg, + u3x_sam_7, &pub, 0) || + c3n == u3r_cell(msg, &len, &dat) || + (c3n == u3ud(sig)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(len)) || + (c3n == u3ud(dat)) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_veri_octs(sig, len, dat, pub); + } + } + + static u3_atom + _cqee_veri(u3_noun s, + u3_noun m, + u3_noun pk) + { + c3_y sig_y[64], pub_y[32]; + + if ( (0 != u3r_bytes_fit(64, sig_y, s)) || + (0 != u3r_bytes_fit(32, pub_y, pk)) ) { + return c3n; + } + else { + c3_w met_w; + c3_y* mes_y = u3r_bytes_all(&met_w, m); + c3_t val_t = urcrypt_ed_veri(mes_y, met_w, pub_y, sig_y); + u3a_free(mes_y); + + return val_t ? c3y : c3n; + } + } + + u3_noun + u3wee_veri(u3_noun cor) + { + u3_noun a, b, c; + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &a, u3x_sam_6, &b, + u3x_sam_7, &c, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_veri(a, b, c); + } + } diff --git a/vere/pkg/noun/jets/e/fein_ob.c b/vere/pkg/noun/jets/e/fein_ob.c new file mode 100644 index 0000000..65d0f3a --- /dev/null +++ b/vere/pkg/noun/jets/e/fein_ob.c @@ -0,0 +1,90 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "murmur3.h" + +// +feis:ob constant parameters to +fe:ob +// +static const c3_w a_w = 0xffff; +static const c3_w b_w = 0x10000; +static const c3_w k_w = 0xffff0000; + +// +raku:ob +// +static const c3_w rak_w[4] = { 0xb76d5eed, 0xee281300, 0x85bcae01, 0x4b387af7 }; + +/* _fe_ob(): +fe:ob, with constant parameters factored out. +** correct over the domain [0x0, 0xfffe.ffff] +*/ +static c3_w +_fe_ob(c3_w m_w) +{ + c3_w l_w = m_w % a_w; + c3_w r_w = m_w / a_w; + c3_w f_w, t_w; + c3_y j_y, k_y[2]; + + for ( j_y = 0; j_y < 4; j_y++ ) { + k_y[0] = r_w & 0xff; + k_y[1] = (r_w >> 8) & 0xff; + + MurmurHash3_x86_32(k_y, 2, rak_w[j_y], &f_w); + + // NB: this addition can overflow a c3_w (before mod) + // + t_w = ((c3_d)f_w + l_w) % (!(j_y & 1) ? a_w : b_w); + l_w = r_w; + r_w = t_w; + } + + // legendary @max19 + // + return ( a_w == r_w ) + ? (r_w * a_w) + l_w + : (l_w * a_w) + r_w; +} + +/* _feis_ob(): +feis:ob, also offsetting by 0x1.000 (as in +fein:ob). +** correct over the domain [0x1.0000, 0xffff.ffff] +*/ +static c3_w +_feis_ob(c3_w m_w) +{ + c3_w c_w = _fe_ob(m_w - b_w); + return b_w + (( c_w < k_w ) ? c_w : _fe_ob(c_w)); +} + +u3_atom +u3qe_fein_ob(u3_atom pyn) +{ + c3_w sor_w = u3r_met(4, pyn); + + if ( (sor_w < 2) || (sor_w > 4) ) { + return u3k(pyn); + } + + if ( 2 == sor_w ) { + return u3i_word(_feis_ob(u3r_word(0, pyn))); + } + else { + c3_w pyn_w[2]; + u3r_words(0, 2, pyn_w, pyn); + + if ( pyn_w[0] < b_w ) { + return u3k(pyn); + } + else { + pyn_w[0] = _feis_ob(pyn_w[0]); + return u3i_words(2, pyn_w); + } + } +} + +u3_noun +u3we_fein_ob(u3_noun cor) +{ + return u3qe_fein_ob(u3x_atom(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/e/fl.c b/vere/pkg/noun/jets/e/fl.c new file mode 100644 index 0000000..c52309e --- /dev/null +++ b/vere/pkg/noun/jets/e/fl.c @@ -0,0 +1,441 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* structures +*/ + typedef struct _flOptions { + c3_w precision; + mpz_t minExp; + mpz_t expWidth; + c3_w rMode; + c3_w eMode; + } flOptions; + + typedef struct _ea { + mpz_t e; + mpz_t a; + } ea; + + static void + _satom_to_mp(mpz_t a_mp, + u3_atom b) + { + if ( _(u3a_is_cat(b)) ) { + c3_ws c = (b + 1) >> 1; + if ( (b & 1) ) { + c = -c; + } + mpz_init_set_si(a_mp, c); + } + else { + u3r_mp(a_mp, b); + c3_t x = mpz_odd_p(a_mp); + mpz_add_ui(a_mp, a_mp, 1); + mpz_tdiv_q_2exp(a_mp, a_mp, 1); + if ( x ) { + mpz_neg(a_mp, a_mp); + } + } + } + + static u3_noun + _mp_to_satom(mpz_t a_mp) + { + c3_ws b = mpz_sgn(a_mp); + switch ( b ) { + default: return u3m_bail(c3__fail); + case 0: { + mpz_clear(a_mp); + return 0; + } + case 1: { + mpz_mul_2exp(a_mp, a_mp, 1); + return u3i_mp(a_mp); + } + case -1: { + mpz_abs(a_mp, a_mp); + mpz_mul_2exp(a_mp, a_mp, 1); + mpz_sub_ui(a_mp, a_mp, 1); + return u3i_mp(a_mp); + } + } + } + + static void + _noun_to_flOptions(flOptions* a, + u3_noun b) + { + u3_noun c; + u3_atom d, e, f, g, h; + u3x_trel(b, &c, &d, &e); + u3x_trel(c, &f, &g, &h); + + mpz_t i; + u3r_mp(i, f); + if ( !mpz_fits_uint_p(i) ) { + mpz_clear(i); + u3m_bail(c3__exit); + } + a->precision = mpz_get_ui(i); + mpz_clear(i); + + if ( a->precision < 2 ) u3m_bail(c3__exit); + + _satom_to_mp(a->minExp, g); + u3r_mp(a->expWidth, h); + + if ( !(_(u3a_is_cat(d)) && _(u3a_is_cat(e))) ) { + mpz_clear(a->minExp); + mpz_clear(a->expWidth); + u3m_bail(c3__exit); + } + a->rMode = d; + a->eMode = e; + } + + static void + _noun_to_ea(ea* a, + u3_noun b) + { + u3_atom c, d; + u3x_cell(b, &c, &d); + + if ( !(_(u3a_is_cat(c))) ) { + u3m_bail(c3__exit); + } + + _satom_to_mp(a->e, c); + u3r_mp(a->a, d); + } + + static u3_noun + _ea_to_noun(ea* a) + { + u3_atom b = _mp_to_satom(a->e); + u3_atom c = u3i_mp(a->a); + + return u3nc(b, c); + } + + static void + _xpd(ea* a, + flOptions* b) + { + size_t z = mpz_sizeinbase(a->a, 2); + if ( z >= b->precision ) return; + c3_w c = b->precision - z; + + if ( b->eMode != c3__i ) { + mpz_t i; + mpz_init_set(i, a->e); + mpz_sub(i, i, b->minExp); + if ( mpz_sgn(i) < 0 ) { + c = 0; + } + else if ( mpz_fits_uint_p(i) ) + { + c3_w d = mpz_get_ui(i); + c = c3_min(c, d); + } + mpz_clear(i); + } + + mpz_mul_2exp(a->a, a->a, c); + mpz_sub_ui(a->e, a->e, c); + } + + /* a: floating point number, b: flOptions, i: rounding mode, j: sticky bit */ + u3_noun + u3qef_lug(u3_noun a, + u3_noun b, + u3_atom i, + u3_atom j) + { + mpz_t v, g, h; + ea c; + flOptions d; + _noun_to_ea(&c, a); + _noun_to_flOptions(&d, b); + if ( mpz_sgn(c.a) == 0 ) { + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + return u3m_bail(c3__exit); + } + size_t m = mpz_sizeinbase(c.a, 2); + if ( !_(j) && (m <= d.precision) ) { + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + return u3m_bail(c3__exit); + } + c3_w q = 0; + c3_w f = (m > d.precision) ? m - d.precision : 0; + mpz_init(g); + if ( (d.eMode != c3__i) && + (mpz_cmp(c.e, d.minExp) < 0) ) { + mpz_sub(g, d.minExp, c.e); + if ( !mpz_fits_uint_p(g) ) { + mpz_clear(g); + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + return u3m_bail(c3__exit); + } + q = mpz_get_ui(g); + } + q = c3_max(f, q); + mpz_init(v); + mpz_tdiv_r_2exp(v, c.a, q); + mpz_tdiv_q_2exp(c.a, c.a, q); + mpz_add_ui(c.e, c.e, q); + mpz_init_set_ui(h, 1); + if ( q > 0 ) mpz_mul_2exp(h, h, q - 1); + + if ( mpz_sgn(c.a) == 0 ) { + c3_t y; + switch ( i ) { + default: + mpz_clear(v); mpz_clear(h); mpz_clear(g); + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + return u3m_bail(c3__exit); + case c3__fl: + case c3__sm: + mpz_set_ui(c.a, 0); + mpz_set_ui(c.e, 0); + mpz_clear(v); mpz_clear(h); mpz_clear(g); + break; + case c3__ce: + case c3__lg: + mpz_set_ui(c.a, 1); + mpz_set(c.e, d.minExp); + mpz_clear(v); mpz_clear(h); mpz_clear(g); + break; + case c3__ne: + case c3__nt: + case c3__na: + if ( (i != c3__na) && _(j) ) { + y = (mpz_cmp(v, h) <= 0); + } else { + y = (mpz_cmp(v, h) < 0); + } + if ( y ) { + mpz_set_ui(c.a, 0); + mpz_set_ui(c.e, 0); + } else { + mpz_set_ui(c.a, 1); + mpz_set(c.e, d.minExp); + } + mpz_clear(v); mpz_clear(h); mpz_clear(g); + break; + } + goto end; + } + _xpd(&c, &d); + switch ( i ) { + c3_ws x; + default: + mpz_clear(v); mpz_clear(h); mpz_clear(g); + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + return u3m_bail(c3__exit); + case c3__fl: + break; + case c3__lg: + mpz_add_ui(c.a, c.a, 1); + break; + case c3__sm: + if ( (mpz_sgn(v) != 0) || !_(j) ) break; + if ( (mpz_cmp(c.e, d.minExp) == 0) && (d.eMode != c3__i) ) { + mpz_sub_ui(c.a, c.a, 1); + break; + } + mpz_mul_2exp(g, c.a, 1); + mpz_sub_ui(g, g, 1); + if ( mpz_sizeinbase(g, 2) <= d.precision ) { + mpz_sub_ui(c.e, c.e, 1); + mpz_set(c.a, g); + } else { + mpz_sub_ui(c.a, c.a, 1); + } + break; + case c3__ce: + if ( (mpz_sgn(v) != 0) || !_(j) ) { + mpz_add_ui(c.a, c.a, 1); + } + break; + case c3__ne: + if ( mpz_sgn(v) == 0 ) break; + x = mpz_cmp(v, h); + if ( (x == 0) && _(j) ) { + if ( mpz_odd_p(c.a) ) { + mpz_add_ui(c.a, c.a, 1); + } + } + else if ( x >= 0 ) { + mpz_add_ui(c.a, c.a, 1); + } + break; + case c3__na: + case c3__nt: + if ( mpz_sgn(v) == 0 ) break; + x = mpz_cmp(v, h); + if ( (x < 0) ) break; + if ( (i == c3__nt) && (x == 0) ) { + if (!_(j)) mpz_add_ui(c.a, c.a, 1); + } else { + mpz_add_ui(c.a, c.a, 1); + } + break; + } + if ( mpz_sizeinbase(c.a, 2) == (d.precision + 1) ) { + mpz_tdiv_q_2exp(c.a, c.a, 1); + mpz_add_ui(c.e, c.e, 1); + } + if ( mpz_sgn(c.a) == 0 ) { + mpz_set_ui(c.e, 0); + mpz_clear(v); mpz_clear(h); mpz_clear(g); + goto end; + } + mpz_set(g, d.minExp); + mpz_add(g, g, d.expWidth); + if ( (d.eMode != c3__i) && (mpz_cmp(g, c.e) < 0) ) { + mpz_clear(v); mpz_clear(h); mpz_clear(g); + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + return u3nc(c3__i, c3y); + } + mpz_clear(v); mpz_clear(h); mpz_clear(g); + + // all mpz except in c, d structures cleared; c contains result + end: + if ( d.eMode == c3__f ) { + if ( mpz_sizeinbase(c.a, 2) != d.precision ) { + mpz_set_ui(c.a, 0); + mpz_set_ui(c.e, 0); + } + } + u3_noun ret = u3nq(c3__f, c3y, _mp_to_satom(c.e), u3i_mp(c.a)); + mpz_clear(d.minExp); mpz_clear(d.expWidth); + return ret; + } + + u3_noun + u3wef_lug(u3_noun cor) + { + u3_noun a, b, c, d, e; + a = u3x_at(u3x_sam, cor); + b = u3x_at(30, cor); + u3x_trel(a, &c, &d, &e); + + return u3qef_lug(d, b, c, e); + } + + u3_noun + u3qef_drg(u3_noun a, + u3_noun b) + { + ea c; + flOptions d; + _noun_to_ea(&c, a); + _noun_to_flOptions(&d, b); + if ( mpz_sgn(c.a) == 0 ) { + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + u3m_bail(c3__exit); + } + _xpd(&c, &d); + if ( !mpz_fits_sint_p(c.e) ) { + mpz_clear(d.minExp); mpz_clear(d.expWidth); + mpz_clear(c.a); mpz_clear(c.e); + u3m_bail(c3__exit); + } + mpz_t r, s, mn, mp, i, j, u, o; + mpz_init_set(r, c.a); + mpz_init_set_ui(s, 1); + mpz_init_set_ui(mn, 1); + mpz_init(i); + mpz_init(j); + c3_w se = mpz_sgn(c.e); + if ( se == 1 ) { + mpz_mul_2exp(r, r, mpz_get_ui(c.e)); + mpz_mul_2exp(mn, mn, mpz_get_ui(c.e)); + } + else if ( se == -1 ) { + mpz_mul_2exp(s, s, mpz_get_ui(c.e)); + } + mpz_init_set(mp, mn); + mpz_set_ui(i, 1); + mpz_mul_2exp(i, i, d.precision - 1); + if ( (mpz_cmp(c.a, i) == 0) && + ((mpz_cmp(c.e, d.minExp) != 0 ) || + (d.eMode == c3__i)) ) { + mpz_mul_2exp(mp, mp, 1); + mpz_mul_2exp(r, r, 1); + mpz_mul_2exp(s, s, 1); + } + mpz_cdiv_q_ui(i, s, 10); + mpz_set_ui(c.e, 0); + while ( mpz_cmp(r, i) < 0 ) { + mpz_sub_ui(c.e, c.e, 1); + mpz_mul_ui(r, r, 10); + mpz_mul_ui(mn, mn, 10); + mpz_mul_ui(mp, mp, 10); + } + while ( 1 ) { + mpz_mul_2exp(i, r, 1); + mpz_add(i, i, mp); + mpz_mul_2exp(j, s, 1); + if ( mpz_cmp(i, j) < 0 ) { + break; + } + mpz_mul_ui(s, s, 10); + mpz_add_ui(c.e, c.e, 1); + } + mpz_init(u); + mpz_init_set_ui(o, 0); + while ( 1 ) { + mpz_sub_ui(c.e, c.e, 1); + mpz_mul_ui(r, r, 10); + mpz_mul_ui(mn, mn, 10); + mpz_mul_ui(mp, mp, 10); + mpz_tdiv_qr(u, r, r, s); + mpz_mul_2exp(i, r, 1); + mpz_mul_2exp(j, s, 1); + c3_t l = mpz_cmp(i, mn) < 0; + c3_t h = mpz_cmp(j, mp) < 0; + if ( !h ) { + mpz_sub(j, j, mp); + h = mpz_cmp(i, j) > 0; + } + if ( l || h ) { + mpz_mul_ui(o, o, 10); + mpz_add(o, o, u); + if ( h && (!l || (mpz_cmp(i, s) > 0)) ) { + mpz_add_ui(o, o, 1); + } + break; + } + mpz_mul_ui(o, o, 10); + mpz_add(o, o, u); + } + mpz_set(c.a, o); + mpz_clear(r); mpz_clear(s); + mpz_clear(mn); mpz_clear(mp); + mpz_clear(i); mpz_clear(j); mpz_clear(u); + mpz_clear(o); mpz_clear(d.minExp); mpz_clear(d.expWidth); + + return _ea_to_noun(&c); + } + + u3_noun + u3wef_drg(u3_noun cor) + { + u3_noun a, b; + a = u3x_at(u3x_sam, cor); + b = u3x_at(30, cor); + + return u3qef_drg(a, b); + } diff --git a/vere/pkg/noun/jets/e/fynd_ob.c b/vere/pkg/noun/jets/e/fynd_ob.c new file mode 100644 index 0000000..62e65d1 --- /dev/null +++ b/vere/pkg/noun/jets/e/fynd_ob.c @@ -0,0 +1,94 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "murmur3.h" + +// +tail:ob constant parameters to +fe:ob +// +static const c3_w a_w = 0xffff; +static const c3_w b_w = 0x10000; +static const c3_w k_w = 0xffff0000; + +// (flop raku:ob) +// +static const c3_w kar_w[4] = { 0x4b387af7, 0x85bcae01, 0xee281300, 0xb76d5eed }; + +/* _fen_ob(): +fen:ob, with constant parameters factored out. +** correct over the domain [0x0 ... 0xfffe.ffff] +*/ +static c3_w +_fen_ob(c3_w m_w) +{ + c3_w l_w = m_w / a_w; + c3_w r_w = m_w % a_w; + c3_w f_w, t_w; + c3_y j_y, k_y[2]; + + // legendary @max19 + // + if ( a_w == l_w ) { + t_w = l_w; + l_w = r_w; + r_w = t_w; + } + + for ( j_y = 0; j_y < 4; j_y++ ) { + k_y[0] = l_w & 0xff; + k_y[1] = (l_w >> 8) & 0xff; + + MurmurHash3_x86_32(k_y, 2, kar_w[j_y], &f_w); + + t_w = ( j_y & 1 ) + ? ((r_w + a_w) - (f_w % a_w)) % a_w + : ((r_w + b_w) - (f_w % b_w)) % b_w; + r_w = l_w; + l_w = t_w; + } + + return (r_w * a_w) + l_w; +} + +/* _tail_ob(): +feis:ob, also offsetting by 0x1.000 (as in +fynd:ob). +** correct over the domain [0x1.0000, 0xffff.ffff] +*/ +static c3_w +_tail_ob(c3_w m_w) +{ + c3_w c_w = _fen_ob(m_w - b_w); + return b_w + (( c_w < k_w ) ? c_w : _fen_ob(c_w)); +} + +u3_atom +u3qe_fynd_ob(u3_atom pyn) +{ + c3_w sor_w = u3r_met(4, pyn); + + if ( (sor_w < 2) || (sor_w > 4) ) { + return u3k(pyn); + } + + if ( 2 == sor_w ) { + return u3i_word(_tail_ob(u3r_word(0, pyn))); + } + else { + c3_w pyn_w[2]; + u3r_words(0, 2, pyn_w, pyn); + + if ( pyn_w[0] < b_w ) { + return u3k(pyn); + } + else { + pyn_w[0] = _tail_ob(pyn_w[0]); + return u3i_words(2, pyn_w); + } + } +} + +u3_noun +u3we_fynd_ob(u3_noun cor) +{ + return u3qe_fynd_ob(u3x_atom(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/e/hmac.c b/vere/pkg/noun/jets/e/hmac.c new file mode 100644 index 0000000..b14ec1e --- /dev/null +++ b/vere/pkg/noun/jets/e/hmac.c @@ -0,0 +1,94 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qe_hmac(u3_noun haj, + u3_atom boq, + u3_atom out, + u3_atom wik, + u3_atom key, + u3_atom wid, + u3_atom dat) + { + u3_assert(_(u3a_is_cat(boq)) && _(u3a_is_cat(wik)) && _(u3a_is_cat(wid))); + + // prep the hashing gate + u3j_site sit_u; + u3j_gate_prep(&sit_u, u3k(haj)); + + // ensure key and message fit signaled lengths + key = u3qc_end(3, wik, key); + dat = u3qc_end(3, wid, dat); + + // keys longer than block size are shortened by hashing + if (wik > boq) { + key = u3j_gate_slam(&sit_u, u3nc(wik, key)); + wik = out; + } + + // keys shorter than block size are right-padded + if (wik < boq) { + key = u3kc_lsh(3, (boq - wik), key); + } + + // pad key, inner and outer + c3_y trail = (boq % 4); + c3_y padwords = (boq / 4) + (trail == 0 ? 0 : 1); + c3_w innpad[padwords], outpad[padwords]; + memset(innpad, 0x36, padwords * 4); + memset(outpad, 0x5c, padwords * 4); + if ( trail > 0 ) { + innpad[padwords-1] = 0x36363636 >> (8 * (4 - trail)); + outpad[padwords-1] = 0x5c5c5c5c >> (8 * (4 - trail)); + } + u3_atom innkey = u3kc_mix(u3k(key), u3i_words(padwords, innpad)); + u3_atom outkey = u3kc_mix( key , u3i_words(padwords, outpad)); + + // append inner padding to message, then hash + u3_atom innmsg = u3ka_add(u3kc_lsh(3, wid, innkey), dat); + u3_atom innhaj = u3j_gate_slam(&sit_u, u3nc((wid + boq), innmsg)); + + // prepend outer padding to result, hash again + u3_atom outmsg = u3ka_add(u3kc_lsh(3, out, outkey), innhaj); + u3_atom outhaj = u3j_gate_slam(&sit_u, u3nc((out + boq), outmsg)); + + u3j_gate_lose(&sit_u); + return outhaj; + } + + u3_noun + u3we_hmac(u3_noun cor) + { + u3_noun haj, boq, out, wik, key, wid, dat; + + // sample is [[haj boq out] [wik key] [wid dat]] + if ( (c3n == u3r_mean(cor, u3x_sam_4, &haj, + 50, &boq, // +<->- + 51, &out, // +<->+ + u3x_sam_12, &wik, + u3x_sam_13, &key, + u3x_sam_14, &wid, + u3x_sam_15, &dat, 0)) || + (c3n == u3ud(boq)) || + (c3n == u3a_is_cat(boq)) || + (c3n == u3ud(out)) || + (c3n == u3a_is_cat(out)) || + (c3n == u3ud(wik)) || + (c3n == u3a_is_cat(wik)) || + (c3n == u3ud(key)) || + (c3n == u3ud(wid)) || + (c3n == u3a_is_cat(wid)) || + (c3n == u3ud(dat)) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qe_hmac(haj, boq, out, wik, key, wid, dat); + } + } diff --git a/vere/pkg/noun/jets/e/jam.c b/vere/pkg/noun/jets/e/jam.c new file mode 100644 index 0000000..2291bc0 --- /dev/null +++ b/vere/pkg/noun/jets/e/jam.c @@ -0,0 +1,60 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qe_jam(u3_atom a) +{ +#if 0 + if (c3y == u3du(a) && 1337 == u3h(a)) { + c3_w siz_w, tot_w = 0; + u3_noun som; + for ( som = u3t(a); c3y == u3du(som); som = u3t(som) ) { + siz_w = u3a_count_noun(u3h(som)); + tot_w += siz_w; + if ( 0 == siz_w ) { + u3l_log("item: B/0"); + } + else { + u3a_print_memory(stderr, "item", siz_w); + } + } + if ( u3_blip != som ) { + u3l_log("forgot to terminate list!"); + } + c3_w mem_w = u3h_count(u3R->cax.har_p); + + for ( som = u3t(a); c3y == u3du(som); som = u3t(som) ) u3a_discount_noun(u3h(som)); + u3h_discount(u3R->cax.har_p); + + u3a_print_memory(stderr, "total", tot_w); + u3a_print_memory(stderr, "memoization cache", mem_w); + u3h_root* har_u = u3to(u3h_root, u3R->cax.har_p); + u3l_log("memoization entries: %d", har_u->use_w); + u3a_print_memory(stderr, "unused free", u3a_open(u3R)); + return tot_w; + } +#endif + + u3i_slab sab_u; + u3s_jam_fib(&sab_u, a); + return u3i_slab_mint(&sab_u); +} + +u3_noun +u3we_jam(u3_noun cor) +{ + return u3qe_jam(u3x_at(u3x_sam, cor)); +} + +u3_atom +u3ke_jam(u3_noun a) +{ + u3_atom b = u3qe_jam(a); + u3z(a); + return b; +} diff --git a/vere/pkg/noun/jets/e/json_de.c b/vere/pkg/noun/jets/e/json_de.c new file mode 100644 index 0000000..e54393a --- /dev/null +++ b/vere/pkg/noun/jets/e/json_de.c @@ -0,0 +1,258 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +#include "pdjson.h" + +/* +** custom code for interfacing with external parser: +** https://github.com/skeeto/pdjson +*/ + +typedef struct _u3qedj_coll { + u3_noun col; // collection (list for array, map for object) + union { // store context for recursive arrays/objects: + u3_noun* tel; // - pointer to tail for array + u3_atom key; // - key for object + }; +} u3qedj_coll; + +static u3qedj_coll* +_push_stack(const u3a_pile *pil_u) +{ + u3qedj_coll *res_u = u3a_push(pil_u); + u3a_pile_done(pil_u); + + res_u->col = u3_nul; + res_u->key = u3_none; + + return res_u; +} + +static u3qedj_coll* +_pop_stack(const u3a_pile *pil_u) +{ + return u3a_pop(pil_u); +} + +static void +_close_stack(const u3a_pile *pil_u) +{ + while ( c3n == u3a_pile_done(pil_u) ) { + u3qedj_coll *tak_u = u3a_peek(pil_u); + + u3z(tak_u->col); + if ( u3_none != tak_u->key ) { + u3z(tak_u->key); + } + + u3a_drop(pil_u); + } +} + +static void +_close_on_error(json_stream *sam_u, const u3a_pile *pil_u) +{ + _close_stack(pil_u); + json_close(sam_u); +} + +static u3_atom +_json_get_string_as_atom(json_stream *sam_u) { + // length returned by json_get_string includes the trailing null byte + // it's possible for json_get_string to return a length of 0, but only if: + // - it's called directly after init + // - it's called directly after init_string + size_t len_i; + const c3_c *str_c = json_get_string(sam_u, &len_i); + return (len_i <= 1) ? + u3_nul : + u3i_bytes(len_i - 1, (const c3_y *)str_c); +} + +static u3_noun +_parse(u3_atom txt) +{ + // + // vars + // + + u3qedj_coll *tak_u; + + json_allocator loc_u = {u3a_malloc, u3a_realloc, u3a_free}; + json_stream sem_u; + json_stream* sam_u = &sem_u; + + u3a_pile pel_u; + u3a_pile *pil_u = &pel_u; + + u3_noun res = u3_none; + u3_noun val; + + const c3_y *byt_y; + c3_z cnt_z; + c3_w len_w = u3r_met(3, txt); + + // + // initialization + // + + // XX assumes little-endian + // + if ( c3y == u3a_is_cat(txt) ) { + byt_y = (c3_y*)&txt; + } + else { + u3a_atom* vat_u = u3a_to_ptr(txt); + byt_y = (c3_y*)vat_u->buf_w; + } + json_open_buffer(sam_u, byt_y, len_w); + json_set_allocator(sam_u, &loc_u); + u3a_pile_prep(pil_u, sizeof(u3qedj_coll)); + + // + // core logic + // + + while ( json_peek(sam_u) != JSON_DONE ) { + switch ( json_next(sam_u) ) { + // unreachable barring programming error + default: u3_assert(0); + + case JSON_ARRAY: + case JSON_OBJECT: { + tak_u = _push_stack(pil_u); + } continue; + + case JSON_ARRAY_END: { + val = u3nc(c3__a, tak_u->col); + tak_u = _pop_stack(pil_u); + } break; + + case JSON_OBJECT_END: { + val = u3nc(c3__o, tak_u->col); + tak_u = _pop_stack(pil_u); + } break; + + case JSON_STRING: { + if ( (json_get_context(sam_u, &cnt_z) == JSON_OBJECT) && (cnt_z & 1) ) { + // since object key must be followed by value, skip ahead + tak_u->key = _json_get_string_as_atom(sam_u); + continue; + } + else { + val = u3nc(c3__s, _json_get_string_as_atom(sam_u)); + break; + } + } + + case JSON_NUMBER: { + // read number from string in the JSON reparser + val = u3nc(c3__n, _json_get_string_as_atom(sam_u)); + } break; + + case JSON_TRUE: { + val = u3nc(c3__b, c3y); + } break; + + case JSON_FALSE: { + val = u3nc(c3__b, c3n); + } break; + + case JSON_NULL: { + val = u3_nul; + } break; + + case JSON_ERROR: { + _close_on_error(sam_u, pil_u); + return u3_nul; + } break; + } + + switch ( json_get_context(sam_u, &cnt_z) ) { + // unreachable barring programming error + default: u3_assert(0); + + case JSON_DONE: { + res = val; + } break; + + case JSON_ARRAY: { + u3_noun* nex; + u3_noun* hed; + + if ( tak_u->col == u3_nul ) { + nex = &(tak_u->col); + } + else { + nex = tak_u->tel; + } + + *nex = u3i_defcons(&hed, &(tak_u->tel)); + *hed = val; + *(tak_u->tel) = u3_nul; + } break; + + case JSON_OBJECT: { + // odd cnt_z and unset key weeded out by continue command on key + u3_assert(!(cnt_z & 1)); + u3_assert(tak_u->key != u3_none); + // cnt_z == 0 weeded out by continue command on array/object open + u3_assert(cnt_z); + + tak_u->col = u3kdb_put(tak_u->col, tak_u->key, val); + tak_u->key = u3_none; + } break; + } + } + + // + // clean up + // + + u3_assert(c3y == u3a_pile_done(pil_u)); + + // skip over whitespce + while ( json_isspace(json_source_peek(sam_u)) ) { + json_source_get(sam_u); + } + + json_close(sam_u); + + // return null if trailing trash/multiple JSON objects + if ( json_get_position(sam_u) != len_w ) { + u3z(res); + return u3_nul; + } + else { + return u3nc(u3_nul, res); + } +} + +/* +** jet interface functions +*/ + +u3_noun +u3qe_json_de(u3_atom a) +{ + return _parse(a); +} + +u3_noun +u3ke_json_de(u3_atom a) +{ + u3_noun res = u3qe_json_de(a); + u3z(a); + return res; +} + +u3_noun +u3we_json_de(u3_noun cor) +{ + return u3qe_json_de(u3x_atom(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/e/json_en.c b/vere/pkg/noun/jets/e/json_en.c new file mode 100644 index 0000000..f605ab4 --- /dev/null +++ b/vere/pkg/noun/jets/e/json_en.c @@ -0,0 +1,416 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* +** structs +*/ + +typedef struct _json_buffer { + c3_y *buf_y; + c3_w len_w; +} json_buffer; + +/* +** constants +*/ + +const c3_y _JSON_NULL[] = "null"; +const c3_y _JSON_TRUE[] = "true"; +const c3_y _JSON_FALSE[] = "false"; +const c3_y _JSON_NEWLINE[] = "\\n"; +const c3_y _JSON_DOQ[] = "\\\""; +const c3_y _JSON_BAS[] = "\\\\"; +const c3_y _JSON_DEL[] = "\\u007f"; +const c3_y *_JSON_UNICODES[] = { + (c3_y*)"\\u0000", // 0 + (c3_y*)"\\u0001", // 1 + (c3_y*)"\\u0002", // 2 + (c3_y*)"\\u0003", // 3 + (c3_y*)"\\u0004", // 4 + (c3_y*)"\\u0005", // 5 + (c3_y*)"\\u0006", // 6 + (c3_y*)"\\u0007", // 7 + (c3_y*)"\\u0008", // 8 + (c3_y*)"\\u0009", // 9 + (c3_y*)"\\u000a", // 10 + (c3_y*)"\\u000b", // 11 + (c3_y*)"\\u000c", // 12 + (c3_y*)"\\u000d", // 13 + (c3_y*)"\\u000e", // 14 + (c3_y*)"\\u000f", // 15 + (c3_y*)"\\u0010", // 16 + (c3_y*)"\\u0011", // 17 + (c3_y*)"\\u0012", // 18 + (c3_y*)"\\u0013", // 19 + (c3_y*)"\\u0014", // 20 + (c3_y*)"\\u0015", // 21 + (c3_y*)"\\u0016", // 22 + (c3_y*)"\\u0017", // 23 + (c3_y*)"\\u0018", // 24 + (c3_y*)"\\u0019", // 25 + (c3_y*)"\\u001a", // 26 + (c3_y*)"\\u001b", // 27 + (c3_y*)"\\u001c", // 28 + (c3_y*)"\\u001d", // 29 + (c3_y*)"\\u001e", // 30 + (c3_y*)"\\u001f", // 31 +}; + +/* +** forward declarations +*/ + +static c3_w +_measure(u3_noun a); + +static void +_serialize(json_buffer*, u3_noun); + +/* +** core jet logic +*/ + +static void +_append_char(json_buffer *buf_u, c3_y c_y) +{ + buf_u->buf_y[(buf_u->len_w)++] = c_y; +} + +static void +_append_text(json_buffer *buf_u, const c3_y *buf_y, c3_w len_w) +{ + memcpy(&(buf_u->buf_y[buf_u->len_w]), buf_y, len_w); + buf_u->len_w += len_w; +} + +static c3_w +_measure_loobean(u3_noun a) +{ + switch ( a ) { + default: u3m_bail(c3__exit); + case c3y: return sizeof(_JSON_TRUE) - 1; + case c3n: return sizeof(_JSON_FALSE) - 1; + } +} + +static void +_serialize_loobean(json_buffer *buf_u, u3_noun a) +{ + switch ( a ) { + default: u3_assert(0); + case c3y: _append_text(buf_u, _JSON_TRUE, sizeof(_JSON_TRUE) - 1); break; + case c3n: _append_text(buf_u, _JSON_FALSE, sizeof(_JSON_FALSE) - 1); break; + } +} + +static c3_w +_measure_number(u3_noun a) +{ + if ( _(u3du(a)) ) { + u3m_bail(c3__exit); + } + + return u3r_met(3, a); +} + +static void +_serialize_number(json_buffer *buf_u, u3_noun a) +{ + const c3_y *byt_y; + + // XX assumes little-endian + // + if ( c3y == u3a_is_cat(a) ) { + byt_y = (c3_y*)&a; + } + else { + u3a_atom* vat_u = u3a_to_ptr(a); + byt_y = (c3_y*)vat_u->buf_w; + } + + _append_text(buf_u, byt_y, u3r_met(3, a)); +} + +static c3_w +_measure_string(u3_noun a) +{ + if ( _(u3du(a)) ) { + u3m_bail(c3__exit); + } + + c3_w len_w = u3r_met(3, a); + c3_w siz_w = 0; + + for (c3_w i = 0; i < len_w; ++i) { + c3_y c_y = u3r_byte(i, a); + + switch ( c_y ) { + case 0 ... 9: + case 11 ... 31: { + siz_w += 6; + } break; + + case 10: { + siz_w += sizeof(_JSON_NEWLINE) - 1; + } break; + + case 34: { + siz_w += sizeof(_JSON_DOQ) - 1; + } break; + + case 92: { + siz_w += sizeof(_JSON_BAS) - 1; + } break; + + case 127: { + siz_w += sizeof(_JSON_DEL) - 1; + } break; + + default: { + siz_w += 1; + } break; + } + } + + // surrounding double quotes + return (siz_w + 2); +} + +static void +_serialize_string(json_buffer *buf_u, u3_noun a) +{ + c3_w len_w = u3r_met(3, a); + + _append_char(buf_u, '"'); + for (c3_w i = 0; i < len_w; ++i) { + c3_y c_y = u3r_byte(i, a); + + switch ( c_y ) { + case 0 ... 9: + case 11 ... 31: { + _append_text(buf_u, _JSON_UNICODES[c_y], 6); + } break; + + case 10: { + _append_text(buf_u, _JSON_NEWLINE, sizeof(_JSON_NEWLINE) - 1); + } break; + + case 34: { + _append_text(buf_u, _JSON_DOQ, sizeof(_JSON_DOQ) - 1); + } break; + + case 92: { + _append_text(buf_u, _JSON_BAS, sizeof(_JSON_BAS) - 1); + } break; + + case 127: { + _append_text(buf_u, _JSON_DEL, sizeof(_JSON_DEL) - 1); + } break; + + default: { + _append_char(buf_u, c_y); + } break; + } + } + _append_char(buf_u, '"'); +} + +static c3_w +_measure_array(u3_noun a) +{ + if ( u3_nul != a ) { + u3_noun i, t = a; + // array open brace + c3_w siz_w = 1; + + while ( u3_nul != t ) { + u3x_cell(t, &i, &t); + siz_w += _measure(i); + // comma or array close brace + siz_w += 1; + } + + return siz_w; + } + else { + // empty array + return 2; + } +} + +static void +_serialize_array(json_buffer *buf_u, u3_noun a) +{ + _append_char(buf_u, '['); + + if ( u3_nul != a ) { + u3_noun i, t = a; + + while ( u3_nul != t ) { + u3x_cell(t, &i, &t); + _serialize(buf_u, i); + _append_char(buf_u, ','); + } + + // Remove trailing comma from array contents + --buf_u->len_w; + } + + _append_char(buf_u, ']'); +} + +static c3_w +_measure_object_helper(u3_noun a) +{ + c3_w siz_w = 0; + + if ( u3_nul != a ) { + u3_noun n_a, l_a, r_a; + u3_noun pn_a, qn_a; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_cell(n_a, &pn_a, &qn_a); + + siz_w += _measure_object_helper(r_a); + siz_w += _measure_object_helper(l_a); + + siz_w += _measure_string(pn_a); + siz_w += _measure(qn_a); + + // colon and comma (or closing brace) + siz_w += 2; + } + + return siz_w; +} + +static void +_serialize_object_helper(json_buffer *buf_u, u3_noun a) +{ + if ( u3_nul != a ) { + u3_noun n_a, l_a, r_a; + u3_noun pn_a, qn_a; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_cell(n_a, &pn_a, &qn_a); + + // order is important to match unjetted tree traversal + _serialize_object_helper(buf_u, r_a); + + _serialize_string(buf_u, pn_a); + _append_char(buf_u, ':'); + _serialize(buf_u, qn_a); + _append_char(buf_u, ','); + + _serialize_object_helper(buf_u, l_a); + } +} + +static c3_w +_measure_object(u3_noun a) +{ + if ( u3_nul != a ) { + // opening brace + return 1 + _measure_object_helper(a); + } + else { + // empty object + return 2; + } +} + +static void +_serialize_object(json_buffer *buf_u, u3_noun a) +{ + _append_char(buf_u, '{'); + + if ( u3_nul != a ) { + _serialize_object_helper(buf_u, a); + + // Remove trailing comma from object contents + --buf_u->len_w; + } + + _append_char(buf_u, '}'); +} + +static c3_w +_measure(u3_noun a) +{ + if ( u3_nul == a ) { + return sizeof(_JSON_NULL) - 1; + } + else { + u3_noun s, p; + u3x_cell(a, &s, &p); + + switch ( s ) { + default: u3m_bail(c3__fail); + case c3__a: return _measure_array(p); + case c3__o: return _measure_object(p); + case c3__b: return _measure_loobean(p); + case c3__n: return _measure_number(p); + case c3__s: return _measure_string(p); + } + } +} + +static void +_serialize(json_buffer *buf_u, u3_noun a) +{ + if ( u3_nul == a ) { + _append_text(buf_u, _JSON_NULL, sizeof(_JSON_NULL) - 1); + } + else { + u3_noun s, p; + u3x_cell(a, &s, &p); + + switch ( s ) { + default: u3_assert(0); + case c3__a: _serialize_array(buf_u, p); break; + case c3__o: _serialize_object(buf_u, p); break; + case c3__b: _serialize_loobean(buf_u, p); break; + case c3__n: _serialize_number(buf_u, p); break; + case c3__s: _serialize_string(buf_u, p); break; + } + } +} + +/* +** jet interface functions +*/ + +u3_atom +u3qe_json_en(u3_noun a) +{ + u3i_slab sab_u; + json_buffer bof_u; + json_buffer *buf_u = &bof_u; + c3_w siz_w = _measure(a); + + u3i_slab_init(&sab_u, 3, siz_w); + buf_u->buf_y = sab_u.buf_y; + buf_u->len_w = 0; + + // note that it's structurally integral to call measure before serialize + _serialize(buf_u, a); + + return u3i_slab_mint_bytes(&sab_u); +} + +u3_atom +u3ke_json_en(u3_noun a) +{ + u3_atom res = u3qe_json_en(a); + u3z(a); + return res; +} + +u3_atom +u3we_json_en(u3_noun cor) +{ + return u3qe_json_en(u3x_at(u3x_sam, cor)); +} diff --git a/vere/pkg/noun/jets/e/keccak.c b/vere/pkg/noun/jets/e/keccak.c new file mode 100644 index 0000000..6149c55 --- /dev/null +++ b/vere/pkg/noun/jets/e/keccak.c @@ -0,0 +1,42 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + +#define defw(bits,byts) \ + u3_atom \ + _kecc_##bits(c3_w len_w, u3_atom a) \ + { \ + c3_y out[byts]; \ + c3_y* buf_y = u3r_bytes_alloc(0, len_w, a); \ + if ( 0 != urcrypt_keccak_##bits(buf_y, len_w, out) ) { \ + /* urcrypt_keccac_##bits always succeeds when called correctly */ \ + return u3m_bail(c3__oops); \ + } \ + else { \ + u3_atom pro = u3i_bytes(byts, out); \ + u3a_free(buf_y); \ + return pro; \ + } \ + } \ + \ + u3_weak \ + u3we_kecc##bits(u3_noun cor) \ + { \ + c3_w len_w; \ + u3_noun len, tom; \ + u3x_mean(cor, u3x_sam_2, &len, u3x_sam_3, &tom, 0); \ + return ( (c3n == u3ud(len)) || (c3n == u3ud(tom)) ) \ + ? u3m_bail(c3__exit) \ + : (!u3r_word_fit(&len_w, len)) \ + ? u3m_bail(c3__fail) \ + : _kecc_##bits(len_w, tom); \ + } + +defw(224, 28) +defw(256, 32) +defw(384, 48) +defw(512, 64) diff --git a/vere/pkg/noun/jets/e/leer.c b/vere/pkg/noun/jets/e/leer.c new file mode 100644 index 0000000..8ffe372 --- /dev/null +++ b/vere/pkg/noun/jets/e/leer.c @@ -0,0 +1,131 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_atom +_leer_cut(c3_w pos_w, c3_w len_w, u3_atom src) +{ + if ( 0 == len_w ) { + return 0; + } + else { + u3i_slab sab_u; + u3i_slab_bare(&sab_u, 3, len_w); + sab_u.buf_w[sab_u.len_w - 1] = 0; + + u3r_bytes(pos_w, len_w, sab_u.buf_y, src); + + return u3i_slab_mint_bytes(&sab_u); + } +} + +// Leaving the lore jet in place for backwards compatibility. +// TODO: remove u3[qw]e_lore (also from jet tree) + +u3_noun +u3qe_lore(u3_atom lub) +{ + c3_w len_w = u3r_met(3, lub); + c3_w pos_w = 0; + u3_noun tez = u3_nul; + + while ( 1 ) { + c3_w meg_w = 0; + c3_y end_y; + + c3_y byt_y; + while ( 1 ) { + if ( pos_w >= len_w ) { + byt_y = 0; + end_y = c3y; + break; + } + byt_y = u3r_byte(pos_w + meg_w, lub); + + if ( (10 == byt_y) || (0 == byt_y) ) { + end_y = __(byt_y == 0); + break; + } else meg_w++; + } + + if ((byt_y == 0) && ((pos_w + meg_w + 1) < len_w)) { + return u3m_bail(c3__exit); + } + + if ( !_(end_y) && pos_w >= len_w ) { + return u3kb_flop(tez); + } + else { + tez = u3nc(_leer_cut(pos_w, meg_w, lub), tez); + if ( _(end_y) ) { + return u3kb_flop(tez); + } + pos_w += (meg_w + 1); + } + } +} + +u3_noun +u3we_lore(u3_noun cor) +{ + u3_noun lub; + + if ( (u3_none == (lub = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(lub)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qe_lore(lub); + } +} + +u3_noun +u3qe_leer(u3_atom txt) +{ + u3_noun pro; + u3_noun* lit = &pro; + + { + c3_w pos_w, i_w = 0, len_w = u3r_met(3, txt); + u3_noun* hed; + u3_noun* tel; + + while ( i_w < len_w ) { + // scan till end or newline + // + for ( pos_w = i_w; i_w < len_w; ++i_w ) { + if ( 10 == u3r_byte(i_w, txt) ) { + break; + } + } + + // append to list + // + *lit = u3i_defcons(&hed, &tel); + *hed = _leer_cut(pos_w, i_w - pos_w, txt); + lit = tel; + + i_w++; + } + } + + *lit = u3_nul; + + return pro; +} + +u3_noun +u3we_leer(u3_noun cor) +{ + u3_noun txt = u3x_at(u3x_sam, cor); + + if ( c3n == u3ud(txt) ) { + return u3m_bail(c3__fail); + } + + return u3qe_leer(txt); +} diff --git a/vere/pkg/noun/jets/e/loss.c b/vere/pkg/noun/jets/e/loss.c new file mode 100644 index 0000000..35cdc4e --- /dev/null +++ b/vere/pkg/noun/jets/e/loss.c @@ -0,0 +1,297 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + typedef struct _u3_loss { // loss problem + u3_noun hel; // a as a list + c3_w lel_w; // length of a + c3_w lev_w; // length of b + u3_noun* hev; // b as an array + u3_noun sev; // b as a set of lists + c3_w kct_w; // candidate count + u3_noun* kad; // candidate array + } u3_loss; + + // free loss object + // + static void + _flem(u3_loss* loc_u) + { + u3z(loc_u->sev); + { + c3_w i_w; + + for ( i_w = 0; i_w < loc_u->kct_w; i_w++ ) { + u3z(loc_u->kad[i_w]); + } + } + u3a_free(loc_u->hev); + u3a_free(loc_u->kad); + } + + // extract lcs - XX don't use the stack like this + // + static u3_noun + _lext(u3_loss* loc_u, + u3_noun kad) + { + if ( u3_nul == kad ) { + return u3_nul; + } else { + return u3nc(u3k(loc_u->hev[u3r_word(0, u3h(kad))]), + _lext(loc_u, u3t(kad))); + } + } + + // extract lcs + // + static u3_noun + _lexs(u3_loss* loc_u) + { + if ( 0 == loc_u->kct_w ) { + return u3_nul; + } else return u3kb_flop(_lext(loc_u, loc_u->kad[loc_u->kct_w - 1])); + } + + // initialize loss object + // + static void + _lemp(u3_loss* loc_u, + u3_noun hel, + u3_noun hev) + { + loc_u->hel = hel; + loc_u->lel_w = u3kb_lent(u3k(hel)); + + // Read hev into array. + { + c3_w i_w; + + loc_u->hev = u3a_malloc(u3kb_lent(u3k(hev)) * sizeof(u3_noun)); + + for ( i_w = 0; u3_nul != hev; i_w++ ) { + loc_u->hev[i_w] = u3h(hev); + hev = u3t(hev); + } + loc_u->lev_w = i_w; + } + loc_u->kct_w = 0; + loc_u->kad = u3a_malloc((1 + c3_min(loc_u->lev_w, loc_u->lel_w)) * + sizeof(u3_noun)); + + // Compute equivalence classes. + // + loc_u->sev = u3_nul; + { + c3_w i_w; + + for ( i_w = 0; i_w < loc_u->lev_w; i_w++ ) { + u3_noun how = loc_u->hev[i_w]; + u3_noun hav; + u3_noun teg; + + hav = u3kdb_get(u3k(loc_u->sev), u3k(how)); + teg = u3nc(u3i_words(1, &i_w), + (hav == u3_none) ? u3_nul : hav); + loc_u->sev = u3kdb_put(loc_u->sev, u3k(how), teg); + } + } + } + + // apply + // + static void + _lune(u3_loss* loc_u, + c3_w inx_w, + c3_w goy_w) + { + u3_noun kad; + + kad = u3nc(u3i_words(1, &goy_w), + (inx_w == 0) ? u3_nul + : u3k(loc_u->kad[inx_w - 1])); + if ( loc_u->kct_w == inx_w ) { + u3_assert(loc_u->kct_w < (1 << 31)); + loc_u->kct_w++; + } else { + u3z(loc_u->kad[inx_w]); + } + loc_u->kad[inx_w] = kad; + } + + // extend fits top + // + static u3_noun + _hink(u3_loss* loc_u, + c3_w inx_w, + c3_w goy_w) + { + return __ + ( (loc_u->kct_w == inx_w) || + (u3r_word(0, u3h(loc_u->kad[inx_w])) > goy_w) ); + } + + // extend fits bottom + // + static u3_noun + _lonk(u3_loss* loc_u, + c3_w inx_w, + c3_w goy_w) + { + return __ + ( (0 == inx_w) || + (u3r_word(0, u3h(loc_u->kad[inx_w - 1])) < goy_w) ); + } + +#if 0 + // search for first index >= inx_w and <= max_w that fits + // the hink and lonk criteria. + // + static u3_noun + _binka(u3_loss* loc_u, + c3_w* inx_w, + c3_w max_w, + c3_w goy_w) + { + while ( *inx_w <= max_w ) { + if ( c3n == _lonk(loc_u, *inx_w, goy_w) ) { + return c3n; + } + if ( c3y == _hink(loc_u, *inx_w, goy_w) ) { + return c3y; + } + else ++*inx_w; + } + return c3n; + } +#endif + + // search for lowest index >= inx_w and <= max_w for which + // both hink(inx_w) and lonk(inx_w) are true. lonk is false + // if inx_w is too high, hink is false if it is too low. + // + static u3_noun + _bink(u3_loss* loc_u, + c3_w* inx_w, + c3_w max_w, + c3_w goy_w) + { + u3_assert(max_w >= *inx_w); + + if ( max_w == *inx_w ) { + if ( c3n == _lonk(loc_u, *inx_w, goy_w) ) { + return c3n; + } + if ( c3y == _hink(loc_u, *inx_w, goy_w) ) { + return c3y; + } + else { + ++*inx_w; + return c3n; + } + } + else { + c3_w mid_w = *inx_w + ((max_w - *inx_w) / 2); + + if ( (c3n == _lonk(loc_u, mid_w, goy_w)) || + (c3y == _hink(loc_u, mid_w, goy_w)) ) + { + return _bink(loc_u, inx_w, mid_w, goy_w); + } else { + *inx_w = mid_w + 1; + return _bink(loc_u, inx_w, max_w, goy_w); + } + } + } + + + static void + _merg(u3_loss* loc_u, + c3_w inx_w, + u3_noun gay) + { + if ( (u3_nul == gay) || (inx_w > loc_u->kct_w) ) { + return; + } + else { + u3_noun i_gay = u3h(gay); + c3_w goy_w = u3r_word(0, i_gay); + u3_noun bik; + + bik = _bink(loc_u, &inx_w, loc_u->kct_w, goy_w); + + if ( c3y == bik ) { + _merg(loc_u, inx_w + 1, u3t(gay)); + _lune(loc_u, inx_w, goy_w); + } + else { + _merg(loc_u, inx_w, u3t(gay)); + } + } + } + + // compute lcs + // + static void + _loss(u3_loss* loc_u) + { + while ( u3_nul != loc_u->hel ) { + u3_noun i_hel = u3h(loc_u->hel); + u3_noun guy = u3kdb_get(u3k(loc_u->sev), u3k(i_hel)); + + if ( u3_none != guy ) { + u3_noun gay = u3kb_flop(guy); + + _merg(loc_u, 0, gay); + u3z(gay); + } + + loc_u->hel = u3t(loc_u->hel); + } + } + + u3_noun + u3qe_loss(u3_noun hel, + u3_noun hev) + { + u3_loss loc_u; + u3_noun lcs; + + _lemp(&loc_u, hel, hev); + _loss(&loc_u); + lcs = _lexs(&loc_u); + + _flem(&loc_u); + return lcs; + } + + static u3_noun + _listp(u3_noun lix) + { + while ( 1 ) { + if ( u3_nul == lix ) return c3y; + if ( c3n == u3du(lix) ) return c3n; + lix = u3t(lix); + } + } + + u3_noun + u3we_loss(u3_noun cor) + { + u3_noun hel, hev; + + if ( (u3_none == (hel = u3r_at(u3x_sam_2, cor))) || + (u3_none == (hev = u3r_at(u3x_sam_3, cor))) || + (c3n == _listp(hel)) || + (c3n == _listp(hev)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qe_loss(hel, hev); + } + } diff --git a/vere/pkg/noun/jets/e/lune.c b/vere/pkg/noun/jets/e/lune.c new file mode 100644 index 0000000..1187073 --- /dev/null +++ b/vere/pkg/noun/jets/e/lune.c @@ -0,0 +1,57 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qe_lune(u3_atom lub) + { + if (lub == 0) { + return u3_nul; + } + + { + c3_w end_w = u3r_met(3, lub) - 1; + c3_w pos_w = end_w; + u3_noun lin = u3_nul; + + if (u3r_byte(pos_w, lub) != 10) { + return u3m_error("noeol"); + } + + if (pos_w == 0) { + return u3nc(u3_nul, lin); + } + + while (--pos_w) { + if (u3r_byte(pos_w, lub) == 10) { + lin = u3nc(u3qc_cut(3, (pos_w + 1), (end_w - pos_w - 1), lub), lin); + end_w = pos_w; + } + } + + if (u3r_byte(pos_w, lub) == 10) { + return u3nc(u3_nul, + u3nc(u3qc_cut(3, (pos_w + 1), (end_w - pos_w - 1), lub), lin)); + } + + return u3nc(u3qc_cut(3, pos_w, (end_w - pos_w), lub), lin); + } + } + + u3_noun + u3we_lune(u3_noun cor) + { + u3_noun lub; + + if ( (u3_none == (lub = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(lub)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qe_lune(lub); + } + } diff --git a/vere/pkg/noun/jets/e/mat.c b/vere/pkg/noun/jets/e/mat.c new file mode 100644 index 0000000..89de386 --- /dev/null +++ b/vere/pkg/noun/jets/e/mat.c @@ -0,0 +1,49 @@ + /// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3qe_mat(u3_atom a) + { + if ( 0 == a ) { + return u3nc(1, 1); + } else { + u3_atom b = u3qc_met(0, a); + u3_atom c = u3qc_met(0, b); + u3_atom u, v, w, x, y, z; + u3_atom p, q; + + u = u3qa_dec(c); + v = u3qa_add(c, c); + w = u3qc_bex(c); + x = u3qc_end(0, u, b); + y = u3qc_lsh(0, u, a); + z = u3qc_mix(x, y); + + p = u3qa_add(v, b); + q = u3qc_cat(0, w, z); + + u3z(u); + u3z(v); + u3z(w); + u3z(x); + u3z(y); + u3z(z); + + return u3nc(p, q); + } + } + u3_noun + u3we_mat(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ) { + return u3m_bail(c3__fail); + } else { + return u3qe_mat(a); + } + } diff --git a/vere/pkg/noun/jets/e/mice.c b/vere/pkg/noun/jets/e/mice.c new file mode 100644 index 0000000..81b4a33 --- /dev/null +++ b/vere/pkg/noun/jets/e/mice.c @@ -0,0 +1,23 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +/* variant of u3we_mink() / u3m_soft_run(). caching, no scry. +*/ +u3_noun +u3we_mice(u3_noun cor) { + u3_noun bus, fol; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &bus, + u3x_sam_3, &fol, + 0) ) + { + return u3m_bail(c3__exit); + } + else { + return u3m_soft_cax(u3n_nock_on, u3k(bus), u3k(fol)); + } +} diff --git a/vere/pkg/noun/jets/e/mink.c b/vere/pkg/noun/jets/e/mink.c new file mode 100644 index 0000000..4caa208 --- /dev/null +++ b/vere/pkg/noun/jets/e/mink.c @@ -0,0 +1,27 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + u3_noun + u3we_mink(u3_noun cor) + { + u3_noun bus, fol, gul; + + if ( c3n == u3r_mean(cor, u3x_sam_4, &bus, + u3x_sam_5, &fol, + u3x_sam_3, &gul, + 0) ) + { + return u3m_bail(c3__exit); + } + else { + u3_noun som; + + som = u3n_nock_et(u3k(gul), u3k(bus), u3k(fol)); + + return som; + } + } diff --git a/vere/pkg/noun/jets/e/mole.c b/vere/pkg/noun/jets/e/mole.c new file mode 100644 index 0000000..a318390 --- /dev/null +++ b/vere/pkg/noun/jets/e/mole.c @@ -0,0 +1,18 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3we_mole(u3_noun cor) +{ + u3_noun hok = u3j_cook("u3we_mole-mure", u3k(cor), "mure"); + + // just like +mule and +mute, this takes advantage of the fact that + // +mure's result is identical to that of +mole, and safely produces + // a statically-typed value while only evaluating the trap once. + // + return u3n_slam_on(hok, u3k(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/e/mule.c b/vere/pkg/noun/jets/e/mule.c new file mode 100644 index 0000000..79e4656 --- /dev/null +++ b/vere/pkg/noun/jets/e/mule.c @@ -0,0 +1,19 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3we_mule(u3_noun cor) +{ + u3_noun hok = u3j_cook("u3we_mule-mute", u3k(cor), "mute"); + + + // this takes advantage of the fact that +mute's result is + // identical to that of +mule, and safely produces a statically-typed + // value while only evaluating the trap once. + // + return u3n_slam_on(hok, u3k(u3x_at(u3x_sam, cor))); +} diff --git a/vere/pkg/noun/jets/e/parse.c b/vere/pkg/noun/jets/e/parse.c new file mode 100644 index 0000000..4ae8ab0 --- /dev/null +++ b/vere/pkg/noun/jets/e/parse.c @@ -0,0 +1,1052 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + // get p.u.q.vex from an $edge, assumes that the unit is non-empty + // RETAIN [vex] + // + static inline u3_noun + _puq(u3_noun vex) + { + u3_weak pro = u3r_at(14, vex); + c3_dessert(u3_none != pro); + return (u3_noun)pro; + } + + // get q.u.q.vex from an $edge, assumes that the unit is non-empty + // RETAIN [vex] + // + static inline u3_noun + _quq(u3_noun vex) + { + u3_weak pro = u3r_at(15, vex); + c3_dessert(u3_none != pro); + return (u3_noun)pro; + } + + #define _p u3h + #define _q u3t + + static u3_noun + _slip(u3_noun weq, + u3_noun naz) + { + u3_noun p_naz, q_naz; + + u3x_cell(naz, &p_naz, &q_naz); + if ( 10 == weq ) { + return u3nc(u3i_vint(u3k(p_naz)), 1); + } else { + return u3nc(u3k(p_naz), u3i_vint(u3k(q_naz))); + } + } + + static u3_noun + _fail(u3_noun tub) + { + u3_noun p_tub, q_tub; + + u3x_cell(tub, &p_tub, &q_tub); + return u3nc(u3k(p_tub), u3_nul); + } + + static u3_noun + _last(u3_noun zyc, + u3_noun naz) + { + u3_noun p_zyc, q_zyc, p_naz, q_naz; + + u3x_cell(zyc, &p_zyc, &q_zyc); + u3x_cell(naz, &p_naz, &q_naz); + + if ( !_(u3a_is_cat(p_zyc)) || !_(u3a_is_cat(q_zyc)) || + !_(u3a_is_cat(p_naz)) || !_(u3a_is_cat(q_naz)) ) + { + return u3m_bail(c3__fail); + } else { + if ( p_zyc == p_naz ) { + return (q_zyc > q_naz) ? u3k(zyc) : u3k(naz); + } + else { + return (p_zyc > p_naz) ? u3k(zyc) : u3k(naz); + } + } + } + + static u3_noun + _last_k(u3_noun zyc, u3_noun naz) + { + u3_noun pro = _last(zyc, naz); + u3z(zyc); u3z(naz); + return pro; + } + + static u3_noun + _next(u3_noun tub) + { + u3_noun p_tub, q_tub; + u3_noun zac; + + u3x_cell(tub, &p_tub, &q_tub); + if ( c3n == u3du(q_tub) ) { + return _fail(tub); + } + else { + u3_noun iq_tub = u3h(q_tub); + u3_noun tq_tub = u3t(q_tub); + + zac = _slip(iq_tub, p_tub); + + return u3nc(zac, + u3nq(u3_nul, + u3k(iq_tub), + u3k(zac), + u3k(tq_tub))); + } + } + +/* bend +*/ + static u3_noun + _cqe_bend_fun(u3_noun raq, + u3_noun vex, + u3_noun sab) + { + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + if ( c3n == u3du(q_vex) ) { + return u3k(vex); + } else { + u3_noun uq_vex = u3t(q_vex); + u3_noun quq_vex; + u3_noun yit, yur; + u3_noun p_yit, q_yit; + u3_noun ret; + + quq_vex = u3t(uq_vex); + + yit = u3n_slam_on(u3k(sab), u3k(quq_vex)); + + u3x_cell(yit, &p_yit, &q_yit); + yur = _last(_p(vex), p_yit); + + if ( c3n == u3du(q_yit) ) { + ret = u3nc(yur, u3k(q_vex)); + } + else { + u3_noun uq_yit = u3t(q_yit); + u3_noun puq_yit; + u3_noun vux; + + puq_yit = u3h(uq_yit); + + vux = u3n_slam_on(u3k(raq), + u3nc(u3k(_puq(vex)), + u3k(puq_yit))); + if ( u3_nul == vux ) { + ret = u3nc(yur, u3k(_q(vex))); + } + else { + ret = u3nq(yur, + u3_nul, + u3k(u3t(vux)), + u3k(_quq(yit))); + u3z(vux); + } + } + u3z(yit); + return ret; + } + } + + u3_noun + u3we_bend_fun(u3_noun cor) + { + u3_noun van, raq, vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, + u3x_sam_3, &sab, + u3x_con, &van, 0)) || + (u3_none == (raq = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_bend_fun(raq, vex, sab); + } + } + +/* cold +*/ + static u3_noun + _cqe_cold_fun(u3_noun cus, + u3_noun sef, + u3_noun tub) + { + u3_noun vex = u3n_slam_on(u3k(sef), u3k(tub)); + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + + if ( c3n == u3du(q_vex) ) { + return vex; + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun quq_vex; + u3_noun ret; + + u3x_cell(uq_vex, 0, &quq_vex); + ret = u3nq(u3k(p_vex), + u3_nul, + u3k(cus), + u3k(quq_vex)); + + u3z(vex); + return ret; + } + } + + u3_noun + u3we_cold_fun(u3_noun cor) + { + u3_noun van, cus, sef, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_mean(van, u3x_sam_2, &cus, u3x_sam_3, &sef, 0)) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_cold_fun(cus, sef, tub); + } + } + +/* cook +*/ + static u3_noun + _cqe_cook_fun(u3_noun poq, + u3_noun sef, + u3_noun tub) + { + u3_noun vex = u3n_slam_on(u3k(sef), u3k(tub)); + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + + if ( c3n == u3du(q_vex) ) { + return vex; + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun puq_vex, quq_vex; + u3_noun wag; + u3_noun ret; + + u3x_cell(uq_vex, &puq_vex, &quq_vex); + + u3k(quq_vex); + u3k(p_vex); + wag = u3n_slam_on(u3k(poq), u3k(puq_vex)); + + ret = u3nq(p_vex, + u3_nul, + wag, + quq_vex); + + u3z(vex); + return ret; + } + } + + u3_noun + u3we_cook_fun(u3_noun cor) + { + u3_noun van, poq, sef, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_mean(van, u3x_sam_2, &poq, u3x_sam_3, &sef, 0)) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_cook_fun(poq, sef, tub); + } + } + +/* comp +*/ + static u3_noun + _cqe_comp_fun(u3_noun raq, + u3_noun vex, + u3_noun sab) + { + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + if ( c3n == u3du(q_vex) ) { + return u3k(vex); + } else { + u3_noun uq_vex = u3t(q_vex); + u3_noun puq_vex, quq_vex; + u3_noun yit, yur; + u3_noun p_yit, q_yit; + u3_noun ret; + + u3x_cell(uq_vex, &puq_vex, &quq_vex); + yit = u3n_slam_on(u3k(sab), u3k(quq_vex)); + + u3x_cell(yit, &p_yit, &q_yit); + yur = _last(_p(vex), p_yit); + + if ( c3n == u3du(q_yit) ) { + ret = u3nc(yur, u3k(q_yit)); + } + else { + u3_noun uq_yit = u3t(q_yit); + u3_noun puq_yit, quq_yit; + + u3x_cell(uq_yit, &puq_yit, &quq_yit); + + u3k(quq_yit); + ret = u3nq(yur, + u3_nul, + u3n_slam_on(u3k(raq), + u3nc(u3k(_puq(vex)), + u3k(puq_yit))), + quq_yit); + } + u3z(yit); + return ret; + } + } + + u3_noun + u3we_comp_fun(u3_noun cor) + { + u3_noun van, raq, vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, + u3x_sam_3, &sab, + u3x_con, &van, 0)) || + (u3_none == (raq = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_comp_fun(raq, vex, sab); + } + } + +/* easy +*/ + static u3_noun + _cqe_easy_fun(u3_noun huf, + u3_noun tub) + { + u3_noun p_tub, q_tub; + + u3x_cell(tub, &p_tub, &q_tub); + return u3nq(u3k(p_tub), + u3_nul, + u3k(huf), + u3k(tub)); + } + + u3_noun + u3we_easy_fun(u3_noun cor) + { + u3_noun van, huf, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (u3_none == (huf = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_easy_fun(huf, tub); + } + } + +/* glue +*/ + static u3_noun + _cqe_glue_fun(u3_noun bus, + u3_noun vex, + u3_noun sab) + { + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + if ( c3n == u3du(q_vex) ) { + return u3k(vex); + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun puq_vex, quq_vex; + u3_noun yit, yur; + u3_noun p_yit, q_yit; + u3_noun ret; + + u3x_cell(uq_vex, &puq_vex, &quq_vex); + yit = u3n_slam_on(u3k(bus), u3k(quq_vex)); + + u3x_cell(yit, &p_yit, &q_yit); + yur = _last(_p(vex), p_yit); + + if ( c3n == u3du(q_yit) ) { + ret = u3nc(yur, u3_nul); + } + else { + u3_noun uq_yit = u3t(q_yit); + u3_noun puq_yit, quq_yit; + u3_noun wam, p_wam, q_wam, goy; + + u3x_cell(uq_yit, &puq_yit, &quq_yit); + wam = u3n_slam_on(u3k(sab), u3k(quq_yit)); + + u3x_cell(wam, &p_wam, &q_wam); + goy = _last(yur, p_wam); + u3z(yur); + + if ( c3n == u3du(q_wam) ) { + ret = u3nc(goy, u3_nul); + } else { + u3_noun uq_wam = u3t(q_wam); + u3_noun puq_wam, quq_wam; + + u3x_cell(uq_wam, &puq_wam, &quq_wam); + ret = u3nq(goy, + u3_nul, + u3nc(u3k(_puq(vex)), + u3k(puq_wam)), + u3k(quq_wam)); + } + u3z(wam); + } + u3z(yit); + return ret; + } + } + + u3_noun + u3we_glue_fun(u3_noun cor) + { + u3_noun van, bus, vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, + u3x_sam_3, &sab, + u3x_con, &van, 0)) || + (u3_none == (bus = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_glue_fun(bus, vex, sab); + } + } + +/* here +*/ + static u3_noun + _cqe_here_fun(u3_noun hez, + u3_noun sef, + u3_noun tub) + { + u3_noun vex = u3n_slam_on(u3k(sef), u3k(tub)); + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + + if ( c3n == u3du(q_vex) ) { + return vex; + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun p_tub, q_tub; + u3_noun puq_vex, quq_vex, pquq_vex; + u3_noun gud, wag; + u3_noun ret; + + u3x_cell(tub, &p_tub, &q_tub); + u3x_cell(uq_vex, &puq_vex, &quq_vex); + u3x_cell(quq_vex, &pquq_vex, 0); + gud = u3nc( + u3nc(u3k(p_tub), + u3k(pquq_vex)), + u3k(puq_vex)); + + u3k(p_vex); + u3k(quq_vex); + wag = u3n_slam_on(u3k(hez), gud); + ret = u3nq(p_vex, + u3_nul, + wag, + quq_vex); + + u3z(vex); + return ret; + } + } + + u3_noun + u3we_here_fun(u3_noun cor) + { + u3_noun van, hez, sef, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_mean(van, u3x_sam_2, &hez, u3x_sam_3, &sef, 0)) ) + { + return u3m_bail(c3__fail); + } + else { + return _cqe_here_fun(hez, sef, tub); + } + } + +/* just +*/ + static u3_noun + _cqe_just_fun(u3_noun daf, + u3_noun tub) + { + u3_noun p_tub, q_tub; + + u3x_cell(tub, &p_tub, &q_tub); + + if ( c3n == u3du(q_tub) ) { + return _fail(tub); + } + else { + u3_noun iq_tub = u3h(q_tub); + + if ( c3y == u3r_sing(daf, iq_tub) ) { + return _next(tub); + } + else return _fail(tub); + } + } + u3_noun + u3we_just_fun(u3_noun cor) + { + u3_noun van, daf, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (u3_none == (daf = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_just_fun(daf, tub); + } + } + +/* mask +*/ + static u3_noun + _cqe_mask_fun(u3_noun bud, + u3_noun tub) + { + u3_noun p_tub, q_tub; + + u3x_cell(tub, &p_tub, &q_tub); + + if ( c3n == u3du(q_tub) ) { + return _fail(tub); + } + else { + u3_noun iq_tub = u3h(q_tub); + + while ( c3y == u3du(bud) ) { + if ( c3y == u3r_sing(u3h(bud), iq_tub) ) { + return _next(tub); + } + bud = u3t(bud); + } + return _fail(tub); + } + } + u3_noun + u3we_mask_fun(u3_noun cor) + { + u3_noun van, bud, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (u3_none == (bud = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_mask_fun(bud, tub); + } + } +/* pfix +*/ + static u3_noun + _cqe_pfix(u3_noun vex, + u3_noun sab) + { + u3_noun q_vex; + + q_vex = u3t(vex); + if ( c3n == u3du(q_vex) ) { + return u3k(vex); + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun quq_vex; + u3_noun yit, p_yit, q_yit; + u3_noun ret; + + quq_vex = u3t(uq_vex); + + yit = u3n_slam_on(u3k(sab), u3k(quq_vex)); + + u3x_cell(yit, &p_yit, &q_yit); + ret = u3nc(_last(_p(vex), p_yit), + u3k(q_yit)); + + u3z(yit); + return ret; + } + } + u3_noun + u3we_pfix(u3_noun cor) + { + u3_noun vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + return u3m_bail(c3__exit); + } else { + return _cqe_pfix(vex, sab); + } + } + +/* plug +*/ + static u3_noun + _cqe_plug(u3_noun vex, + u3_noun sab) + { + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + if ( c3n == u3du(q_vex) ) { + return u3k(vex); + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun puq_vex, quq_vex; + u3_noun yit, yur; + u3_noun p_yit, q_yit; + u3_noun ret; + + u3x_cell(uq_vex, &puq_vex, &quq_vex); + yit = u3n_slam_on(u3k(sab), u3k(quq_vex)); + + u3x_cell(yit, &p_yit, &q_yit); + yur = _last(_p(vex), p_yit); + + if ( c3n == u3du(q_yit) ) { + ret = u3nc(yur, u3k(q_yit)); + } + else { + u3_noun uq_yit = u3t(q_yit); + u3_noun puq_yit, quq_yit; + + u3x_cell(uq_yit, &puq_yit, &quq_yit); + ret = u3nq(yur, + u3_nul, + u3nc(u3k(_puq(vex)), + u3k(puq_yit)), + u3k(quq_yit)); + } + u3z(yit); + return ret; + } + } + u3_noun + u3we_plug(u3_noun cor) + { + u3_noun vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + return u3m_bail(c3__exit); + } else { + return _cqe_plug(vex, sab); + } + } + +/* pose +*/ + u3_noun + u3qe_pose(u3_noun vex, + u3_noun sab) + { + u3_noun q_vex; + + q_vex = u3t(vex); + if ( c3y == u3du(q_vex) ) { + return u3k(vex); + } else { + u3_noun roq = u3n_kick_on(u3k(sab)); + u3_noun p_roq, q_roq; + u3_noun ret; + + u3x_cell(roq, &p_roq, &q_roq); + ret = u3nc(_last(_p(vex), p_roq), + u3k(q_roq)); + + u3z(roq); + return ret; + } + } + u3_noun + u3we_pose(u3_noun cor) + { + u3_noun vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + return u3m_bail(c3__exit); + } else { + return u3qe_pose(vex, sab); + } + } + +/* sfix +*/ + static u3_noun + _cqe_sfix(u3_noun vex, + u3_noun sab) + { + u3_noun q_vex; + + q_vex = u3t(vex); + if ( c3n == u3du(q_vex) ) { + return u3k(vex); + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun quq_vex; + u3_noun yit, p_yit, q_yit, yur; + u3_noun ret; + + quq_vex = u3t(uq_vex); + + yit = u3n_slam_on(u3k(sab), u3k(quq_vex)); + + u3x_cell(yit, &p_yit, &q_yit); + yur = _last(_p(vex), p_yit); + + if ( c3n == u3du(q_yit) ) { + ret = u3nc(yur, u3_nul); + } + else { + u3_noun uq_yit = u3t(q_yit); + u3_noun puq_yit, quq_yit; + + u3x_cell(uq_yit, &puq_yit, &quq_yit); + + ret = u3nq(yur, + u3_nul, + u3k(_puq(vex)), + u3k(quq_yit)); + } + u3z(yit); + return ret; + } + } + u3_noun + u3we_sfix(u3_noun cor) + { + u3_noun vex, sab; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + return u3m_bail(c3__exit); + } else { + return _cqe_sfix(vex, sab); + } + } + +/* shim +*/ + static u3_noun + _cqe_shim_fun(u3_noun zep, + u3_noun tub) + { + u3_noun p_tub, q_tub; + + u3x_cell(tub, &p_tub, &q_tub); + + if ( c3n == u3du(q_tub) ) { + return _fail(tub); + } + else { + u3_noun p_zep, q_zep; + u3_noun iq_tub = u3h(q_tub); + + u3x_cell(zep, &p_zep, &q_zep); + if ( _(u3a_is_cat(p_zep)) && + _(u3a_is_cat(q_zep)) && + _(u3a_is_cat(iq_tub)) ) + { + if ( (iq_tub >= p_zep) && (iq_tub <= q_zep) ) { + return _next(tub); + } + else return _fail(tub); + } + else { + return u3m_bail(c3__fail); + } + } + } + u3_noun + u3we_shim_fun(u3_noun cor) + { + u3_noun van, zep, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (u3_none == (zep = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_shim_fun(zep, tub); + } + } + +/* stag +*/ + static u3_noun + _cqe_stag_fun(u3_noun gob, + u3_noun sef, + u3_noun tub) + { + u3_noun vex = u3n_slam_on(u3k(sef), u3k(tub)); + u3_noun p_vex, q_vex; + + u3x_cell(vex, &p_vex, &q_vex); + + if ( c3n == u3du(q_vex) ) { + return vex; + } + else { + u3_noun uq_vex = u3t(q_vex); + u3_noun puq_vex, quq_vex; + u3_noun wag; + u3_noun ret; + + u3x_cell(uq_vex, &puq_vex, &quq_vex); + wag = u3nc(u3k(gob), u3k(puq_vex)); + ret = u3nq(u3k(p_vex), + u3_nul, + wag, + u3k(quq_vex)); + + u3z(vex); + return ret; + } + } + + u3_noun + u3we_stag_fun(u3_noun cor) + { + u3_noun van, gob, sef, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_mean(van, u3x_sam_2, &gob, u3x_sam_3, &sef, 0)) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_stag_fun(gob, sef, tub); + } + } + +/* stew +*/ + static u3_noun + _stew_wor(u3_noun ort, + u3_noun wan) + { + if ( !_(u3a_is_cat(ort)) ) { + return u3m_bail(c3__fail); + } + else { + if ( c3n == u3du(wan) ) { + if ( !_(u3a_is_cat(wan)) ) { + return u3m_bail(c3__fail); + } + else return (ort < wan) ? c3y : c3n; + } + else { + u3_noun h_wan = u3h(wan); + + if ( !_(u3a_is_cat(h_wan)) ) { + return u3m_bail(c3__fail); + } + else return (ort < h_wan) ? c3y : c3n; + } + } + } + + static u3_noun + _cqe_stew_fun(u3_noun hel, + u3_noun tub) + { + u3_noun p_tub, q_tub; + + u3x_cell(tub, &p_tub, &q_tub); + if ( c3n == u3du(q_tub) ) { + return _fail(tub); + } + else { + u3_noun iq_tub = u3h(q_tub); + + if ( !_(u3a_is_cat(iq_tub)) ) { + return u3m_bail(c3__fail); + } + else while ( 1 ) { + if ( c3n == u3du(hel) ) { + return _fail(tub); + } + else { + u3_noun n_hel, l_hel, r_hel; + u3_noun pn_hel, qn_hel; + c3_o bit_o; + + u3x_trel(hel, &n_hel, &l_hel, &r_hel); + u3x_cell(n_hel, &pn_hel, &qn_hel); + + if ( (c3n == u3du(pn_hel)) ) { + bit_o = __((iq_tub == pn_hel)); + } + else { + u3_noun hpn_hel = u3h(pn_hel); + u3_noun tpn_hel = u3t(pn_hel); + + if ( !_(u3a_is_cat(hpn_hel)) || + !_(u3a_is_cat(tpn_hel)) ) { + return _fail(tub); + } + else bit_o = __((iq_tub >= hpn_hel) && (iq_tub <= tpn_hel)); + } + + if ( c3y == bit_o ) { + return u3n_slam_on(u3k(qn_hel), u3k(tub)); + } else { + if ( c3y == _stew_wor(iq_tub, pn_hel) ) { + hel = l_hel; + } + else hel = r_hel; + } + } + } + } + } + u3_noun + u3we_stew_fun(u3_noun cor) + { + u3_noun con, hel, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &con, 0)) || + (u3_none == (hel = u3r_at(2, con))) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_stew_fun(hel, tub); + } + } + +/* _stir_pair(): stack frame recording intermediate parse results +*/ + typedef struct { + u3_noun har; // hair, p_vex + u3_noun res; // parse-result, puq_vex + } _stir_pair; + +/* stir +*/ + static u3_noun + _cqe_stir_fun(u3_noun rud, + u3_noun raq, + u3_noun fel, + u3_noun tub) + { + // pil_u: stack control structure + // par_u: frame pointer + // wag: initial accumulator (deconstructed) + // + u3a_pile pil_u; + _stir_pair* par_u; + u3_noun p_wag, puq_wag, quq_wag; + + u3a_pile_prep(&pil_u, sizeof(*par_u)); + + // push incremental, successful [fel] parse results onto road stack + // + { + u3_noun vex, p_vex, q_vex, puq_vex, quq_vex; + u3j_site fel_u; + u3j_gate_prep(&fel_u, u3k(fel)); + + vex = u3j_gate_slam(&fel_u, u3k(tub)); + u3x_cell(vex, &p_vex, &q_vex); + + u3k(tub); + + while ( u3_nul != q_vex ) { + u3x_trel(q_vex, 0, &puq_vex, &quq_vex); + + par_u = u3a_push(&pil_u); + par_u->har = u3k(p_vex); + par_u->res = u3k(puq_vex); + + u3z(tub); + tub = u3k(quq_vex); + + u3z(vex); + vex = u3j_gate_slam(&fel_u, u3k(tub)); + u3x_cell(vex, &p_vex, &q_vex); + } + + p_wag = u3k(p_vex); + puq_wag = u3k(rud); + quq_wag = tub; + + u3z(vex); + u3j_gate_lose(&fel_u); + } + + // unwind the stack, folding parse results into [wag] by way of [raq] + // + if ( c3n == u3a_pile_done(&pil_u) ) { + u3j_site raq_u; + u3j_gate_prep(&raq_u, u3k(raq)); + + while ( c3n == u3a_pile_done(&pil_u) ) { + p_wag = _last_k(par_u->har, p_wag); + puq_wag = u3j_gate_slam(&raq_u, u3nc(par_u->res, puq_wag)); + par_u = u3a_pop(&pil_u); + } + + u3j_gate_lose(&raq_u); + } + + return u3nq(p_wag, u3_nul, puq_wag, quq_wag); + } + + u3_noun + u3we_stir_fun(u3_noun cor) + { + u3_noun van, rud, raq, fel, tub; + + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_mean(van, u3x_sam_2, &rud, + u3x_sam_6, &raq, + u3x_sam_7, &fel, + 0)) ) + { + return u3m_bail(c3__fail); + } else { + return _cqe_stir_fun(rud, raq, fel, tub); + } + } + + #undef _p + #undef _q +
\ No newline at end of file diff --git a/vere/pkg/noun/jets/e/rd.c b/vere/pkg/noun/jets/e/rd.c new file mode 100644 index 0000000..a693e3f --- /dev/null +++ b/vere/pkg/noun/jets/e/rd.c @@ -0,0 +1,390 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "softfloat.h" + +#define DOUBNAN 0x7ff8000000000000 + + union doub { + float64_t d; + c3_d c; + }; + + static inline c3_t + _nan_test(float64_t a) + { + return !f64_eq(a, a); + } + + static inline float64_t + _nan_unify(float64_t a) + { + if ( _nan_test(a) ) + { + *(c3_d*)(&a) = DOUBNAN; + } + return a; + } + + static inline void + _set_rounding(c3_w a) + { + switch ( a ) + { + default: + u3m_bail(c3__fail); + break; + case c3__n: + softfloat_roundingMode = softfloat_round_near_even; + break; + case c3__z: + softfloat_roundingMode = softfloat_round_minMag; + break; + case c3__u: + softfloat_roundingMode = softfloat_round_max; + break; + case c3__d: + softfloat_roundingMode = softfloat_round_min; + break; + } + } + +/* add +*/ + u3_noun + u3qer_add(u3_atom a, + u3_atom b, + u3_atom r) + { + union doub c, d, e; + _set_rounding(r); + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + e.d = _nan_unify(f64_add(c.d, d.d)); + + return u3i_chubs(1, &e.c); + } + + u3_noun + u3wer_add(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_add(a, b, u3x_at(30, cor)); + } + } + +/* sub +*/ + u3_noun + u3qer_sub(u3_atom a, + u3_atom b, + u3_atom r) + { + union doub c, d, e; + _set_rounding(r); + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + e.d = _nan_unify(f64_sub(c.d, d.d)); + + return u3i_chubs(1, &e.c); + } + + u3_noun + u3wer_sub(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_sub(a, b, u3x_at(30, cor)); + } + } + +/* mul +*/ + u3_noun + u3qer_mul(u3_atom a, + u3_atom b, + u3_atom r) + { + union doub c, d, e; + _set_rounding(r); + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + e.d = _nan_unify(f64_mul(c.d, d.d)); + + return u3i_chubs(1, &e.c); + } + + u3_noun + u3wer_mul(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_mul(a, b, u3x_at(30, cor)); + } + } + +/* div +*/ + u3_noun + u3qer_div(u3_atom a, + u3_atom b, + u3_atom r) + { + union doub c, d, e; + _set_rounding(r); + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + e.d = _nan_unify(f64_div(c.d, d.d)); + + return u3i_chubs(1, &e.c); + } + + u3_noun + u3wer_div(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_div(a, b, u3x_at(30, cor)); + } + } + +/* sqt +*/ + u3_noun + u3qer_sqt(u3_atom a, + u3_atom r) + { + union doub c, d; + _set_rounding(r); + c.c = u3r_chub(0, a); + d.d = _nan_unify(f64_sqrt(c.d)); + + return u3i_chubs(1, &d.c); + } + + u3_noun + u3wer_sqt(u3_noun cor) + { + u3_noun a; + + if ( c3n == (a = u3r_at(u3x_sam, cor)) || + c3n == u3ud(a) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_sqt(a, u3x_at(30, cor)); + } + } + +/* fma +*/ + u3_noun + u3qer_fma(u3_atom a, + u3_atom b, + u3_atom c, + u3_atom r) + { + union doub d, e, f, g; + _set_rounding(r); + d.c = u3r_chub(0, a); + e.c = u3r_chub(0, b); + f.c = u3r_chub(0, c); + g.d = _nan_unify(f64_mulAdd(d.d, e.d, f.d)); + + return u3i_chubs(1, &g.c); + } + + u3_noun + u3wer_fma(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) || + c3n == u3ud(c) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_fma(a, b, c, u3x_at(30, cor)); + } + } + +/* lth +*/ + u3_noun + u3qer_lth(u3_atom a, + u3_atom b) + { + union doub c, d; + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + + return __(f64_lt(c.d, d.d)); + } + + u3_noun + u3wer_lth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_lth(a, b); + } + } + +/* lte +*/ + u3_noun + u3qer_lte(u3_atom a, + u3_atom b) + { + union doub c, d; + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + + return __(f64_le(c.d, d.d)); + } + + u3_noun + u3wer_lte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_lte(a, b); + } + } + +/* equ +*/ + u3_noun + u3qer_equ(u3_atom a, + u3_atom b) + { + union doub c, d; + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + + return __(f64_eq(c.d, d.d)); + } + + u3_noun + u3wer_equ(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_equ(a, b); + } + } + +/* gte +*/ + u3_noun + u3qer_gte(u3_atom a, + u3_atom b) + { + union doub c, d; + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + + return __(f64_le(d.d, c.d)); + } + + u3_noun + u3wer_gte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_gte(a, b); + } + } + +/* gth +*/ + u3_noun + u3qer_gth(u3_atom a, + u3_atom b) + { + union doub c, d; + c.c = u3r_chub(0, a); + d.c = u3r_chub(0, b); + + return __(f64_lt(d.d, c.d)); + } + + u3_noun + u3wer_gth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qer_gth(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/rh.c b/vere/pkg/noun/jets/e/rh.c new file mode 100644 index 0000000..3bbb8d4 --- /dev/null +++ b/vere/pkg/noun/jets/e/rh.c @@ -0,0 +1,390 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "softfloat.h" + +#define HALFNAN 0x7e00 + + union half { + float16_t h; + c3_s c; + }; + + static inline c3_t + _nan_test(float16_t a) + { + return !f16_eq(a, a); + } + + static inline float16_t + _nan_unify(float16_t a) + { + if ( _nan_test(a) ) + { + *(c3_s*)(&a) = HALFNAN; + } + return a; + } + + static inline void + _set_rounding(c3_w a) + { + switch ( a ) + { + default: + u3m_bail(c3__fail); + break; + case c3__n: + softfloat_roundingMode = softfloat_round_near_even; + break; + case c3__z: + softfloat_roundingMode = softfloat_round_minMag; + break; + case c3__u: + softfloat_roundingMode = softfloat_round_max; + break; + case c3__d: + softfloat_roundingMode = softfloat_round_min; + break; + } + } + +/* add +*/ + u3_noun + u3qes_add(u3_atom a, + u3_atom b, + u3_atom r) + { + union half c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.h = _nan_unify(f16_add(c.h, d.h)); + + return e.c; + } + + u3_noun + u3wes_add(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_add(a, b, u3x_at(30, cor)); + } + } + +/* sub +*/ + u3_noun + u3qes_sub(u3_atom a, + u3_atom b, + u3_atom r) + { + union half c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.h = _nan_unify(f16_sub(c.h, d.h)); + + return e.c; + } + + u3_noun + u3wes_sub(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_sub(a, b, u3x_at(30, cor)); + } + } + +/* mul +*/ + u3_noun + u3qes_mul(u3_atom a, + u3_atom b, + u3_atom r) + { + union half c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.h = _nan_unify(f16_mul(c.h, d.h)); + + return e.c; + } + + u3_noun + u3wes_mul(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_mul(a, b, u3x_at(30, cor)); + } + } + +/* div +*/ + u3_noun + u3qes_div(u3_atom a, + u3_atom b, + u3_atom r) + { + union half c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.h = _nan_unify(f16_div(c.h, d.h)); + + return e.c; + } + + u3_noun + u3wes_div(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_div(a, b, u3x_at(30, cor)); + } + } + +/* sqt +*/ + u3_noun + u3qes_sqt(u3_atom a, + u3_atom r) + { + union half c, d; + _set_rounding(r); + c.c = u3r_word(0, a); + d.h = _nan_unify(f16_sqrt(c.h)); + + return d.c; + } + + u3_noun + u3wes_sqt(u3_noun cor) + { + u3_noun a; + + if ( c3n == (a = u3r_at(u3x_sam, cor)) || + c3n == u3ud(a) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_sqt(a, u3x_at(30, cor)); + } + } + +/* fma +*/ + u3_noun + u3qes_fma(u3_atom a, + u3_atom b, + u3_atom c, + u3_atom r) + { + union half d, e, f, g; + _set_rounding(r); + d.c = u3r_word(0, a); + e.c = u3r_word(0, b); + f.c = u3r_word(0, c); + g.h = _nan_unify(f16_mulAdd(d.h, e.h, f.h)); + + return g.c; + } + + u3_noun + u3wes_fma(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) || + c3n == u3ud(c) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_fma(a, b, c, u3x_at(30, cor)); + } + } + +/* lth +*/ + u3_noun + u3qes_lth(u3_atom a, + u3_atom b) + { + union half c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f16_lt(c.h, d.h)); + } + + u3_noun + u3wes_lth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_lth(a, b); + } + } + +/* lte +*/ + u3_noun + u3qes_lte(u3_atom a, + u3_atom b) + { + union half c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f16_le(c.h, d.h)); + } + + u3_noun + u3wes_lte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_lte(a, b); + } + } + +/* equ +*/ + u3_noun + u3qes_equ(u3_atom a, + u3_atom b) + { + union half c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f16_eq(c.h, d.h)); + } + + u3_noun + u3wes_equ(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_equ(a, b); + } + } + +/* gte +*/ + u3_noun + u3qes_gte(u3_atom a, + u3_atom b) + { + union half c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f16_le(d.h, c.h)); + } + + u3_noun + u3wes_gte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_gte(a, b); + } + } + +/* gth +*/ + u3_noun + u3qes_gth(u3_atom a, + u3_atom b) + { + union half c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f16_lt(d.h, c.h)); + } + + u3_noun + u3wes_gth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qes_gth(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/ripe.c b/vere/pkg/noun/jets/e/ripe.c new file mode 100644 index 0000000..5d08a9d --- /dev/null +++ b/vere/pkg/noun/jets/e/ripe.c @@ -0,0 +1,45 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqe_ripe(u3_atom wid, u3_atom dat) + { + c3_w len_w; + if ( !u3r_word_fit(&len_w, wid) ) { + return u3m_bail(c3__fail); + } + else { + u3_atom ret; + c3_y out_y[20]; + c3_y *dat_y = u3r_bytes_alloc(0, len_w, dat); + + ret = ( 0 == urcrypt_ripemd160(dat_y, len_w, out_y) ) + ? u3i_bytes(20, out_y) + : u3_none; + + u3a_free(dat_y); + return ret; + } + } + + u3_noun + u3we_ripe(u3_noun cor) + { + u3_noun wid, dat; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, + u3x_sam_3, &dat, 0) || + u3ud(wid) || u3ud(dat)) + ) + { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("ripe", _cqe_ripe(wid, dat)); + } + } diff --git a/vere/pkg/noun/jets/e/rq.c b/vere/pkg/noun/jets/e/rq.c new file mode 100644 index 0000000..e26a4de --- /dev/null +++ b/vere/pkg/noun/jets/e/rq.c @@ -0,0 +1,446 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "softfloat.h" + +#define QUADNAN 0x7fff800000000000 + + union quad { + float128_t* q; + c3_w* c; + }; + + static inline c3_t + _nan_test(float128_t* a) + { + return !f128M_eq(a, a); + } + + static inline void + _nan_unify(float128_t* a) + { + if ( _nan_test(a) ) + { + *( (c3_d*)a) = 0; + *(((c3_d*)a)+1) = QUADNAN; + } + } + + static inline void + _set_rounding(c3_w a) + { + switch ( a ) + { + default: + u3m_bail(c3__fail); + break; + case c3__n: + softfloat_roundingMode = softfloat_round_near_even; + break; + case c3__z: + softfloat_roundingMode = softfloat_round_minMag; + break; + case c3__u: + softfloat_roundingMode = softfloat_round_max; + break; + case c3__d: + softfloat_roundingMode = softfloat_round_min; + break; + } + } + +/* add +*/ + u3_noun + u3qeq_add(u3_atom a, + u3_atom b, + u3_atom r) + { + union quad c, d, e; + _set_rounding(r); + c.c = alloca(16); + d.c = alloca(16); + e.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + f128M_add(c.q, d.q, e.q); + _nan_unify(e.q); + + u3_atom f = u3i_words(4, e.c); + return f; + } + + u3_noun + u3weq_add(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_add(a, b, u3x_at(30, cor)); + } + } + +/* sub +*/ + u3_noun + u3qeq_sub(u3_atom a, + u3_atom b, + u3_atom r) + { + union quad c, d, e; + _set_rounding(r); + c.c = alloca(16); + d.c = alloca(16); + e.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + f128M_sub(c.q, d.q, e.q); + _nan_unify(e.q); + + u3_atom f = u3i_words(4, e.c); + return f; + } + + u3_noun + u3weq_sub(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_sub(a, b, u3x_at(30, cor)); + } + } + +/* mul +*/ + u3_noun + u3qeq_mul(u3_atom a, + u3_atom b, + u3_atom r) + { + union quad c, d, e; + _set_rounding(r); + c.c = alloca(16); + d.c = alloca(16); + e.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + f128M_mul(c.q, d.q, e.q); + _nan_unify(e.q); + + u3_atom f = u3i_words(4, e.c); + return f; + } + + u3_noun + u3weq_mul(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_mul(a, b, u3x_at(30, cor)); + } + } + +/* div +*/ + u3_noun + u3qeq_div(u3_atom a, + u3_atom b, + u3_atom r) + { + union quad c, d, e; + _set_rounding(r); + c.c = alloca(16); + d.c = alloca(16); + e.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + f128M_div(c.q, d.q, e.q); + _nan_unify(e.q); + + u3_atom f = u3i_words(4, e.c); + return f; + } + + u3_noun + u3weq_div(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_div(a, b, u3x_at(30, cor)); + } + } + +/* sqt +*/ + u3_noun + u3qeq_sqt(u3_atom a, + u3_atom r) + { + union quad c, d; + _set_rounding(r); + c.c = alloca(16); + d.c = alloca(16); + + u3r_words(0, 4, c.c, a); + f128M_sqrt(c.q, d.q); + _nan_unify(d.q); + + u3_atom e = u3i_words(4, d.c); + return e; + } + + u3_noun + u3weq_sqt(u3_noun cor) + { + u3_noun a; + + if ( c3n == (a = u3r_at(u3x_sam, cor)) || + c3n == u3ud(a) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_sqt(a, u3x_at(30, cor)); + } + } + +/* fma +*/ + u3_noun + u3qeq_fma(u3_atom a, + u3_atom b, + u3_atom c, + u3_atom r) + { + union quad d, e, f, g; + _set_rounding(r); + d.c = alloca(16); + e.c = alloca(16); + f.c = alloca(16); + g.c = alloca(16); + + u3r_words(0, 4, d.c, a); + u3r_words(0, 4, e.c, b); + u3r_words(0, 4, f.c, c); + f128M_mulAdd(d.q, e.q, f.q, g.q); + _nan_unify(g.q); + + u3_atom h = u3i_words(4, g.c); + return h; + } + + u3_noun + u3weq_fma(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) || + c3n == u3ud(c) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_fma(a, b, c, u3x_at(30, cor)); + } + } + +/* lth +*/ + u3_noun + u3qeq_lth(u3_atom a, + u3_atom b) + { + union quad c, d; + c.c = alloca(16); + d.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + c3_o e = __(f128M_lt(c.q, d.q)); + + return e; + } + + u3_noun + u3weq_lth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_lth(a, b); + } + } + +/* lte +*/ + u3_noun + u3qeq_lte(u3_atom a, + u3_atom b) + { + union quad c, d; + c.c = alloca(16); + d.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + c3_o e = __(f128M_le(c.q, d.q)); + + return e; + } + + u3_noun + u3weq_lte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_lte(a, b); + } + } + +/* equ +*/ + u3_noun + u3qeq_equ(u3_atom a, + u3_atom b) + { + union quad c, d; + c.c = alloca(16); + d.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + c3_o e = __(f128M_eq(c.q, d.q)); + + return e; + } + + u3_noun + u3weq_equ(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_equ(a, b); + } + } + +/* gte +*/ + u3_noun + u3qeq_gte(u3_atom a, + u3_atom b) + { + union quad c, d; + c.c = alloca(16); + d.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + c3_o e = __(f128M_le(d.q, c.q)); + + return e; + } + + u3_noun + u3weq_gte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_gte(a, b); + } + } + +/* gth +*/ + u3_noun + u3qeq_gth(u3_atom a, + u3_atom b) + { + union quad c, d; + c.c = alloca(16); + d.c = alloca(16); + + u3r_words(0, 4, c.c, a); + u3r_words(0, 4, d.c, b); + c3_o e = __(f128M_lt(d.q, c.q)); + + return e; + } + + u3_noun + u3weq_gth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qeq_gth(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/rs.c b/vere/pkg/noun/jets/e/rs.c new file mode 100644 index 0000000..360d1c9 --- /dev/null +++ b/vere/pkg/noun/jets/e/rs.c @@ -0,0 +1,390 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "softfloat.h" + +#define SINGNAN 0x7fc00000 + + union sing { + float32_t s; + c3_w c; + }; + + static inline c3_t + _nan_test(float32_t a) + { + return !f32_eq(a, a); + } + + static inline float32_t + _nan_unify(float32_t a) + { + if ( _nan_test(a) ) + { + *(c3_w*)(&a) = SINGNAN; + } + return a; + } + + static inline void + _set_rounding(c3_w a) + { + switch ( a ) + { + default: + u3m_bail(c3__fail); + break; + case c3__n: + softfloat_roundingMode = softfloat_round_near_even; + break; + case c3__z: + softfloat_roundingMode = softfloat_round_minMag; + break; + case c3__u: + softfloat_roundingMode = softfloat_round_max; + break; + case c3__d: + softfloat_roundingMode = softfloat_round_min; + break; + } + } + +/* add +*/ + u3_noun + u3qet_add(u3_atom a, + u3_atom b, + u3_atom r) + { + union sing c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.s = _nan_unify(f32_add(c.s, d.s)); + + return u3i_words(1, &e.c); + } + + u3_noun + u3wet_add(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_add(a, b, u3x_at(30, cor)); + } + } + +/* sub +*/ + u3_noun + u3qet_sub(u3_atom a, + u3_atom b, + u3_atom r) + { + union sing c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.s = _nan_unify(f32_sub(c.s, d.s)); + + return u3i_words(1, &e.c); + } + + u3_noun + u3wet_sub(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_sub(a, b, u3x_at(30, cor)); + } + } + +/* mul +*/ + u3_noun + u3qet_mul(u3_atom a, + u3_atom b, + u3_atom r) + { + union sing c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.s = _nan_unify(f32_mul(c.s, d.s)); + + return u3i_words(1, &e.c); + } + + u3_noun + u3wet_mul(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_mul(a, b, u3x_at(30, cor)); + } + } + +/* div +*/ + u3_noun + u3qet_div(u3_atom a, + u3_atom b, + u3_atom r) + { + union sing c, d, e; + _set_rounding(r); + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + e.s = _nan_unify(f32_div(c.s, d.s)); + + return u3i_words(1, &e.c); + } + + u3_noun + u3wet_div(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_div(a, b, u3x_at(30, cor)); + } + } + +/* sqt +*/ + u3_noun + u3qet_sqt(u3_atom a, + u3_atom r) + { + union sing c, d; + _set_rounding(r); + c.c = u3r_word(0, a); + d.s = _nan_unify(f32_sqrt(c.s)); + + return u3i_words(1, &d.c); + } + + u3_noun + u3wet_sqt(u3_noun cor) + { + u3_noun a; + + if ( c3n == (a = u3r_at(u3x_sam, cor)) || + c3n == u3ud(a) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_sqt(a, u3x_at(30, cor)); + } + } + +/* fma +*/ + u3_noun + u3qet_fma(u3_atom a, + u3_atom b, + u3_atom c, + u3_atom r) + { + union sing d, e, f, g; + _set_rounding(r); + d.c = u3r_word(0, a); + e.c = u3r_word(0, b); + f.c = u3r_word(0, c); + g.s = _nan_unify(f32_mulAdd(d.s, e.s, f.s)); + + return u3i_words(1, &g.c); + } + + u3_noun + u3wet_fma(u3_noun cor) + { + u3_noun a, b, c; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) || + c3n == u3ud(c) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_fma(a, b, c, u3x_at(30, cor)); + } + } + +/* lth +*/ + u3_noun + u3qet_lth(u3_atom a, + u3_atom b) + { + union sing c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f32_lt(c.s, d.s)); + } + + u3_noun + u3wet_lth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_lth(a, b); + } + } + +/* lte +*/ + u3_noun + u3qet_lte(u3_atom a, + u3_atom b) + { + union sing c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f32_le(c.s, d.s)); + } + + u3_noun + u3wet_lte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_lte(a, b); + } + } + +/* equ +*/ + u3_noun + u3qet_equ(u3_atom a, + u3_atom b) + { + union sing c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f32_eq(c.s, d.s)); + } + + u3_noun + u3wet_equ(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_equ(a, b); + } + } + +/* gte +*/ + u3_noun + u3qet_gte(u3_atom a, + u3_atom b) + { + union sing c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f32_le(d.s, c.s)); + } + + u3_noun + u3wet_gte(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_gte(a, b); + } + } + +/* gth +*/ + u3_noun + u3qet_gth(u3_atom a, + u3_atom b) + { + union sing c, d; + c.c = u3r_word(0, a); + d.c = u3r_word(0, b); + + return __(f32_lt(d.s, c.s)); + } + + u3_noun + u3wet_gth(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + c3n == u3ud(a) || + c3n == u3ud(b) ) + { + return u3m_bail(c3__exit); + } + else { + return u3qet_gth(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/rub.c b/vere/pkg/noun/jets/e/rub.c new file mode 100644 index 0000000..81739be --- /dev/null +++ b/vere/pkg/noun/jets/e/rub.c @@ -0,0 +1,85 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qe_rub(u3_atom a, + u3_atom b) + { + u3_atom c, d, e; + u3_atom w, x, y, z; + u3_atom p, q; + + u3_atom m; + { + c3_w bit_w = u3r_met(0, b); + u3_noun bit = u3i_words(1, &bit_w); + m = u3qa_add(a, bit); + u3z(bit); + } + + // Compute c and d. + { + x = u3k(a); + + while ( 0 == u3qc_cut(0, x, 1, b) ) { + u3_atom y = u3qa_inc(x); + + // Sanity check: crash if decoding more bits than available + if ( c3y == u3qa_gth(x, m)) { + // u3l_log("[%%rub-hard %d %d %d]", a, x, m); + return u3m_bail(c3__exit); + } + + u3z(x); + x = y; + } + if ( c3y == u3r_sing(x, a) ) { + u3z(x); + return u3nc(1, 0); + } + c = u3qa_sub(x, a); + d = u3qa_inc(x); + + u3z(x); + } + + // Compute e, p, q. + { + x = u3qa_dec(c); + y = u3qc_bex(x); + z = u3qc_cut(0, d, x, b); + + e = u3qa_add(y, z); + u3z(y); u3z(z); + + w = u3qa_add(c, c); + y = u3qa_add(w, e); + z = u3qa_add(d, x); + + p = u3qa_add(w, e); + q = u3qc_cut(0, z, e, b); + + u3z(w); u3z(x); u3z(y); u3z(z); + + return u3nc(p, q); + } + } + u3_noun + u3we_rub(u3_noun cor) + { + u3_noun a, b; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qe_rub(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/scot.c b/vere/pkg/noun/jets/e/scot.c new file mode 100644 index 0000000..f39c46b --- /dev/null +++ b/vere/pkg/noun/jets/e/scot.c @@ -0,0 +1,30 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +#include <ctype.h> + +u3_atom +u3qe_scot(u3_atom a, u3_atom b) +{ + switch (a) { + case c3__tas: return u3k(b); + case c3__ud: return u3s_etch_ud(b); + case c3__ux: return u3s_etch_ux(b); + case c3__uv: return u3s_etch_uv(b); + case c3__uw: return u3s_etch_uw(b); + default: return u3_none; + } +} + +u3_noun +u3we_scot(u3_noun cor) +{ + u3_atom a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qe_scot(u3x_atom(a), u3x_atom(b)); +} diff --git a/vere/pkg/noun/jets/e/scow.c b/vere/pkg/noun/jets/e/scow.c new file mode 100644 index 0000000..986dc41 --- /dev/null +++ b/vere/pkg/noun/jets/e/scow.c @@ -0,0 +1,251 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +#include <ctype.h> + +static +c3_y to_digit(c3_y tig) +{ + if (tig >= 10) { + return 87 + tig; + } else { + return '0' + tig; + } +} + +// gives the characters for a four 'digit' small hex atom. +static +void +_x_co_four(c3_w src, c3_y* a, c3_y* b, c3_y* c, c3_y* d) +{ + *d = to_digit(src & 0xF); + src >>= 4; + *c = to_digit(src & 0xF); + src >>= 4; + *b = to_digit(src & 0xF); + src >>= 4; + *a = to_digit(src & 0xF); +} + +// The parser always prints two digits on 0 in y-co. +static +void +_y_co_two(c3_w src, c3_y* a, c3_y* b) +{ + *b = to_digit(src % 10); + *a = to_digit(src / 10); +} + +// +static +u3_noun +_add_year(c3_w year, u3_noun out) +{ + while (year > 0) { + out = u3nc(to_digit(year % 10), out); + year = year / 10; + } + + return out; +} + +static +u3_noun +_print_da(u3_noun cor, u3_atom raw_da) +{ + u3_noun hok = u3j_cook("u3we_scow_print_da", u3k(cor), "yore"); + u3_noun yod = u3n_slam_on(hok, u3k(raw_da)); + + u3_noun out = 0; + + u3_atom age, year, month, day, hour, min, sec, f; + if (c3n == u3r_mean(yod, 4, &age, + 5, &year, + 6, &month, + 14, &day, + 30, &hour, + 62, &min, + 126, &sec, + 127, &f, + 0)) { + return u3m_bail(c3__exit); + } + + if (f != 0) { + u3_noun f_list = u3qb_flop(f); + + for (u3_noun cur = f_list; + _(u3a_is_cell(cur)); + cur = u3t(cur)) { + if (_(u3a_is_cat(u3h(cur)))) { + c3_y a, b, c, d; + _x_co_four(u3h(cur), &a, &b, &c, &d); + out = u3nq('.', a, b, u3nt(c, d, out)); + } else { + // No way to deal with big atoms. fall back. + u3z(yod); + u3z(out); + u3z(f_list); + return u3_none; + } + } + + u3z(f_list); + out = u3nc('.', out); + } + + // if there isn't a hex list and the h/m/s are all 0, skip printing hours. + if (f != 0 || hour != 0 || min != 0 || sec != 0) { + if (!_(u3a_is_cat(hour)) || + !_(u3a_is_cat(min)) || + !_(u3a_is_cat(sec))) { + // Input is weird, fallback to nock. + u3z(yod); + u3z(out); + return u3_none; + } + + c3_y sa, sb, ma, mb, ha, hb; + _y_co_two(sec, &sa, &sb); + out = u3nq('.', sa, sb, out); + + _y_co_two(min, &ma, &mb); + out = u3nq('.', ma, mb, out); + + _y_co_two(hour, &ha, &hb); + out = u3nq('.', ha, hb, out); + + out = u3nc('.', out); + } + + // We always print the Y.M.D. Unlike others, these numbers are unconstrained + // by length, but in practice, the month number and day number can only be up + // to two digits because of +yore. We still need to remove 0 prefixes, + // though. + if (!_(u3a_is_cat(day)) || day > 99 || + !_(u3a_is_cat(month)) || month > 99 || + !_(u3a_is_cat(year))) { + // Input is weird, fallback to nock. + u3z(yod); + u3z(out); + return u3_none; + } + + c3_y da, db; + _y_co_two(day, &da, &db); + out = u3nc(db, out); + if (da != '0') { + out = u3nc(da, out); + } + out = u3nc('.', out); + + c3_y ma, mb; + _y_co_two(month, &ma, &mb); + out = u3nc(mb, out); + if (ma != '0') { + out = u3nc(ma, out); + } + out = u3nc('.', out); + + // suffix the year with a '-' for BC dates + if (age == c3n) { + out = u3nc('-', out); + } + + // The year part is the only place where we have to explicitly loop over the + // input because it can be arbitrarily large or small. + out = _add_year(year, out); + + out = u3nc('~', out); + + u3z(yod); + return out; +} + +static +u3_noun +_print_p(u3_atom cor, u3_atom p) +{ + // Scramble the raw number to the concealed version. + u3_noun ob = u3j_cook("u3we_scow_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_scow_fein_p", ob, "fein"); + u3_atom sxz = u3n_slam_on(hok, u3k(p)); + + // Simple galaxy case + if (c3y == u3qa_lth(sxz, 256)) { + c3_y a, b, c; + u3_po_to_suffix(sxz, &a, &b, &c); + u3z(sxz); + return u3nq('~', a, b, u3nc(c, 0)); + } + + u3_atom dyy = u3qc_met(4, sxz); + if (!_(u3a_is_cat(dyy))) { + u3z(sxz); + u3z(dyy); + return u3_none; + } + + u3_noun list = 0; + for (c3_w imp = 0; imp != dyy; ++imp) { + c3_w log = u3qc_end(4, 1, sxz); + c3_w prefix = u3qc_rsh(3, 1, log); + c3_w suffix = u3qc_end(3, 1, log); + + c3_y a, b, c, d, e, f; + u3_po_to_prefix(prefix, &a, &b, &c); + u3_po_to_suffix(suffix, &d, &e, &f); + + if (imp % 4 == 0) { + if (imp != 0) { + list = u3nt('-', '-', list); + } + } else { + list = u3nc('-', list); + } + + list = u3nq(a, b, c, u3nq(d, e, f, list)); + + sxz = u3qc_rsh(4, 1, sxz); + } + + u3z(sxz); + return u3nc('~', list); +} + +u3_atom +u3qe_scow(u3_atom a, u3_atom b) +{ + switch (a) { + // XX disabled due to memory corruption + // rewrite for +scot jet and test there + // + // case c3__da: return _print_da(cor, atom); + // case 'p': return _print_p(cor, atom); + + default: { + u3_weak dat = u3qe_scot(a, b); + u3_weak pro = u3_none; + + if ( u3_none != dat ) { + pro = u3qc_rip(3, 1, dat); + u3z(dat); + } + + return pro; + } + } +} + +u3_noun +u3we_scow(u3_noun cor) +{ + u3_atom a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + return u3qe_scow(u3x_atom(a), u3x_atom(b)); +} diff --git a/vere/pkg/noun/jets/e/scr.c b/vere/pkg/noun/jets/e/scr.c new file mode 100644 index 0000000..e9d0725 --- /dev/null +++ b/vere/pkg/noun/jets/e/scr.c @@ -0,0 +1,227 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_weak + _cqes_hs(u3_atom p, c3_w pwd_w, + u3_atom s, c3_w sal_w, + u3_atom n, + u3_atom r, + u3_atom z, + u3_atom d) + { + u3_noun chk; + c3_w out_w; + + if ( !u3r_word_fit(&out_w, d) ) { + return u3m_bail(c3__fail); + } + if ( 0 == r || 0 == z ) { + return u3m_bail(c3__exit); + } + chk = u3qc_bex(31); + if ( (c3n == u3qa_lth(pwd_w, chk)) || + (c3n == u3qa_lth(sal_w, chk)) ) { + return u3m_bail(c3__exit); + } + u3z(chk); + chk = u3kc_bex(u3ka_dec(u3qc_xeb(n))); + if ( c3n == u3r_sing(n, chk) ) { + return u3m_bail(c3__exit); + } + u3z(chk); + if ( c3n == u3ka_lte( + u3ka_mul(u3qa_mul(128, r), u3ka_dec(u3qa_add(n, z))), + u3qc_bex(30)) ) { + return u3m_bail(c3__exit); + } + + if ( (u3r_met(6, n) > 1) || + (u3r_met(5, r) > 1) || + (u3r_met(5, z) > 1) ) { + return u3_none; + } + else { + u3_noun pro; + c3_d n_d = u3r_chub(0, n); + c3_w r_w = u3r_word(0, r), + z_w = u3r_word(0, z); + c3_y *pwd_y = u3a_malloc(pwd_w), + *sal_y = u3a_malloc(sal_w), + *out_y = u3a_malloc(d); + u3r_bytes(0, pwd_w, pwd_y, p); + u3r_bytes(0, sal_w, sal_y, s); + pro = ( 0 == urcrypt_scrypt(pwd_y, pwd_w, + sal_y, sal_w, + n_d, r_w, z_w, + out_w, out_y) ) + ? u3i_bytes(out_w, out_y) + : u3_none; + u3a_free(pwd_y); + u3a_free(sal_y); + u3a_free(out_y); + return pro; + } + } + + static u3_weak + _cqes_hsl(u3_atom p, u3_atom pl, + u3_atom s, u3_atom sl, + u3_atom n, + u3_atom r, + u3_atom z, + u3_atom d) + { + c3_w pwd_w, sal_w; + if ( !(u3r_word_fit(&pwd_w, pl) && + u3r_word_fit(&sal_w, sl)) ) { + return u3m_bail(c3__fail); + } + else { + return _cqes_hs(p, pwd_w, s, sal_w, n, r, z, d); + } + } + + u3_noun + u3wes_hsl(u3_noun cor) + { + u3_noun p, pl, s, sl, n, r, z, d; + u3_noun q; + + u3x_quil(u3x_at(u3x_sam, cor), &p, &pl, &s, &sl, &q); + u3x_qual(q, &n, &r, &z, &d); + + if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(pl)) && + _(u3a_is_atom(s)) && _(u3a_is_atom(sl)) && + _(u3a_is_atom(n)) && _(u3a_is_atom(r)) && + _(u3a_is_atom(z)) && _(u3a_is_atom(d))) ) { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("scr-hsl", _cqes_hsl(p, pl, s, sl, n, r, z, d)); + } + } + + static u3_weak + _cqes_hsh(u3_atom p, + u3_atom s, + u3_atom n, + u3_atom r, + u3_atom z, + u3_atom d) + { + return _cqes_hs(p, u3r_met(3, p), + s, u3r_met(3, s), + n, r, z, d); + } + + u3_noun + u3wes_hsh(u3_noun cor) + { + u3_noun p, s, n, r, z, d; + u3_noun q; + + u3x_quil(u3x_at(u3x_sam, cor), &p, &s, &n, &r, &q); + u3x_cell(q, &z, &d); + + if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(s)) && + _(u3a_is_atom(n)) && _(u3a_is_atom(r)) && + _(u3a_is_atom(z)) && _(u3a_is_atom(d))) ) { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("scr-hsh", _cqes_hsh(p, s, n, r, z, d)); + } + } + + static u3_atom + _cqes_pb(u3_atom p, c3_w pwd_w, + u3_atom s, c3_w sal_w, + u3_atom c, + u3_atom d) + { + if ( (c > (1 << 28)) || + (d > (1 << 30)) ) { + // max key length 1gb + // max iterations 2^28 + return u3m_bail(c3__exit); + } + else { + u3_noun pro; + c3_y *pwd_y = u3a_malloc(pwd_w), + *sal_y = u3a_malloc(sal_w), + *out_y = u3a_malloc(d); + u3r_bytes(0, pwd_w, pwd_y, p); + u3r_bytes(0, sal_w, sal_y, s); + urcrypt_scrypt_pbkdf_sha256(pwd_y, pwd_w, sal_y, sal_w, c, d, out_y); + pro = u3i_bytes(d, out_y); + u3a_free(pwd_y); + u3a_free(sal_y); + u3a_free(out_y); + return pro; + } + } + + static u3_noun + _cqes_pbl(u3_atom p, u3_atom pl, + u3_atom s, u3_atom sl, + u3_atom c, + u3_atom d) + { + c3_w pwd_w, sal_w; + if ( !(u3r_word_fit(&pwd_w, pl) && + u3r_word_fit(&sal_w, sl)) ) { + return u3m_bail(c3__fail); + } + else { + return _cqes_pb(p, pwd_w, s, sal_w, c, d); + } + } + + u3_noun + u3wes_pbl(u3_noun cor) + { + u3_noun p, pl, s, sl, c, d; + u3_noun q; + + u3x_quil(u3x_at(u3x_sam, cor), &p, &pl, &s, &sl, &q); + u3x_cell(q, &c, &d); + + if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(s)) && + _(u3a_is_atom(pl)) && _(u3a_is_atom(sl)) && + _(u3a_is_atom(c)) && _(u3a_is_atom(d))) ) { + return u3m_bail(c3__exit); + } + else { + return _cqes_pbl(p, pl, s, sl, c, d); + } + } + + static u3_atom + _cqes_pbk(u3_atom p, u3_atom s, u3_atom c, u3_atom d) + { + return _cqes_pb(p, u3r_met(3, p), + s, u3r_met(3, s), + c, d); + } + + u3_noun + u3wes_pbk(u3_noun cor) + { + u3_noun p, s, c, d; + + u3x_qual(u3x_at(u3x_sam, cor), &p, &s, &c, &d); + + if ( !(_(u3a_is_atom(p)) && _(u3a_is_atom(s)) && + _(u3a_is_atom(c)) && _(u3a_is_atom(d))) ) { + return u3m_bail(c3__exit); + } + else { + return _cqes_pbk(p, s, c, d); + } + } diff --git a/vere/pkg/noun/jets/e/secp.c b/vere/pkg/noun/jets/e/secp.c new file mode 100644 index 0000000..fa0fbd2 --- /dev/null +++ b/vere/pkg/noun/jets/e/secp.c @@ -0,0 +1,298 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" +#include "ent/ent.h" + +static urcrypt_secp_context* sec_u; + +/* call at process start */ +void +u3je_secp_init() +{ + c3_y ent_y[32]; + ent_getentropy(ent_y, 32); + sec_u = malloc(urcrypt_secp_prealloc_size()); + + if ( 0 != urcrypt_secp_init(sec_u, ent_y) ) { + u3l_log("u3e_secp_init failed"); + abort(); + } +} + +/* call at process end */ +void +u3je_secp_stop() +{ + urcrypt_secp_destroy(sec_u); + free(sec_u); + sec_u = NULL; +} + +/* util funcs + */ +static c3_t +_cqes_in_order(u3_atom a) +{ + // this is the "n" parameter of the secp256k1 curve + static const c3_w now_w[8] = { + 0xd0364141, 0xbfd25e8c, 0xaf48a03b, 0xbaaedce6, + 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff + }; + + if ( 0 == a ) { + return 0; + } + else if ( c3y == u3a_is_cat(a) ) { + return 1; + } + else { + u3a_atom* a_u = u3a_to_ptr(a); + c3_w len_w = a_u->len_w; + + if ( len_w < 8 ) { + return 1; + } + else if ( len_w > 8 ) { + return 0; + } + else { + c3_y i_y; + c3_w *buf_w = a_u->buf_w; + // loop from most to least significant words + for ( i_y = 8; i_y > 0; ) { + c3_w b_w = buf_w[i_y], + o_w = now_w[--i_y]; + if ( b_w < o_w ) { + return 1; + } + else if ( b_w > o_w ) { + return 0; + } + } + return 1; + } + } +} + +static void +_cqes_unpack_fe(u3_atom k, c3_y out_y[32]) +{ + if ( _cqes_in_order(k) ) { + u3r_bytes(0, 32, out_y, k); + } + else { + u3m_bail(c3__exit); + } +} + +/* sign hash with priv key + */ +static u3_noun +_cqes_sign(u3_atom has, + u3_atom prv) +{ + c3_y has_y[32]; + + if ( 0 != u3r_bytes_fit(32, has_y, has) ) { + return u3m_bail(c3__exit); + } + else { + c3_y prv_y[32], v_y, r_y[32], s_y[32]; + _cqes_unpack_fe(prv, prv_y); + + return( 0 == urcrypt_secp_sign(sec_u, has_y, prv_y, &v_y, r_y, s_y) ) + ? u3nt(v_y, u3i_bytes(32, r_y), u3i_bytes(32, s_y)) + : u3_none; + } +} + +u3_noun +u3we_sign(u3_noun cor) +{ + + u3_noun has, prv; + + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &has, + u3x_sam_3, &prv, + 0)) || + (c3n == u3ud(has)) || + (c3n == u3ud(prv))) { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("secp-sign", _cqes_sign(has, prv)); + } +} + +/* recover pubkey from signature (which is how we verify signatures) +*/ +static u3_noun +_cqes_reco(u3_atom has, + u3_atom siv, /* signature: v */ + u3_atom sir, /* signature: r */ + u3_atom sis) /* signature: s */ +{ + c3_y has_y[32]; + if ( !((siv < 4) && (0 == u3r_bytes_fit(32, has_y, has)) ) ) { + return u3m_bail(c3__exit); + } + else { + c3_y sir_y[32], sis_y[32], x_y[32], y_y[32]; + _cqes_unpack_fe(sir, sir_y); + _cqes_unpack_fe(sis, sis_y); + return + ( 0 == urcrypt_secp_reco(sec_u, has_y, siv, sir_y, sis_y, x_y, y_y) ) + ? u3nc(u3i_bytes(32, x_y), u3i_bytes(32, y_y)) + : u3_none; + } +} + +u3_noun +u3we_reco(u3_noun cor) +{ + u3_noun has, /* hash */ + siv, sir, sis; /* signature: v, r, s */ + + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &has, + u3x_sam_6, &siv, + u3x_sam_14, &sir, + u3x_sam_15, &sis, + 0)) || + (c3n == u3ud(has)) || + (c3n == u3ud(siv)) || + (c3n == u3ud(sir)) || + (c3n == u3ud(sis)) ) { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("secp-reco", _cqes_reco(has, siv, sir, sis)); + } +} + +static u3_atom +_cqes_make(u3_atom has, + u3_atom prv) +{ + c3_y has_y[32]; + + if ( 0 != u3r_bytes_fit(32, has_y, has) ) { + return u3m_bail(c3__exit); + } + else { + c3_y prv_y[32], out_y[32]; + _cqes_unpack_fe(prv, prv_y); + return ( 0 == urcrypt_secp_make(has_y, prv_y, out_y) ) + ? u3i_bytes(32, out_y) + : u3_none; + } +} + +u3_noun +u3we_make(u3_noun cor) +{ + u3_noun has, prv; + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &has, + u3x_sam_3, &prv, + 0)) || + (c3n == u3ud(has)) || + (c3n == u3ud(prv)) ) { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("secp-make", _cqes_make(has, prv)); + } +} + +/* create a schnorr signature +*/ +static u3_weak +_cqes_sosi(u3_atom sk, u3_atom m, u3_atom a) +{ + c3_y key_y[32]; + c3_y mes_y[32]; + c3_y aux_y[32]; + + if ( (0 != u3r_bytes_fit(32, key_y, sk)) || + (0 != u3r_bytes_fit(32, mes_y, m)) || + (0 != u3r_bytes_fit(32, aux_y, a)) ) + { + return u3m_bail(c3__exit); + } + else { + c3_y sig_y[64]; + + return + ( 0 == urcrypt_secp_schnorr_sign(sec_u, key_y, mes_y, aux_y, sig_y) ) + ? u3i_bytes(64, sig_y) + : u3_none; + } +} + +u3_noun +u3we_sosi(u3_noun cor) +{ + u3_noun key, mes, aux; + + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &key, + u3x_sam_6, &mes, + u3x_sam_7, &aux, + 0)) || + (c3n == u3ud(key)) || + (c3n == u3ud(mes)) || + (c3n == u3ud(aux)) ) + { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("secp-sosi", _cqes_sosi(key, mes, aux)); + } +} + +/* verify a schnorr signature +*/ +static u3_atom +_cqes_sove(u3_atom pk, u3_atom m, u3_atom sig) +{ + c3_y pub_y[32]; + c3_y mes_y[32]; + c3_y sig_y[64]; + + if ( (0 != u3r_bytes_fit(32, pub_y, pk)) || + (0 != u3r_bytes_fit(32, mes_y, m)) || + (0 != u3r_bytes_fit(64, sig_y, sig)) ) + { + return u3m_bail(c3__exit); + } + else { + return __(urcrypt_secp_schnorr_veri(sec_u, sig_y, mes_y, pub_y)); + } +} + +u3_noun +u3we_sove(u3_noun cor) +{ + u3_noun pub, mes, sig; + + if ( (c3n == u3r_mean(cor, + u3x_sam_2, &pub, + u3x_sam_6, &mes, + u3x_sam_7, &sig, + 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(mes)) || + (c3n == u3ud(sig)) ) + { + return u3m_bail(c3__exit); + } + else { + return _cqes_sove(pub, mes, sig); + } +} diff --git a/vere/pkg/noun/jets/e/sha1.c b/vere/pkg/noun/jets/e/sha1.c new file mode 100644 index 0000000..729faf6 --- /dev/null +++ b/vere/pkg/noun/jets/e/sha1.c @@ -0,0 +1,40 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_noun + _cqe_sha1(u3_atom wid, u3_atom dat) + { + c3_w len_w; + if ( !u3r_word_fit(&len_w, wid) ) { + return u3m_bail(c3__fail); + } + else { + c3_y out_y[20]; + c3_y *dat_y = u3r_bytes_alloc(0, len_w, dat); + + urcrypt_sha1(dat_y, len_w, out_y); + u3a_free(dat_y); + return u3i_bytes(20, out_y); + } + } + + u3_noun + u3we_sha1(u3_noun cor) + { + u3_noun wid, dat; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, 0)) || + (c3n == u3ud(wid)) || + (c3n == u3ud(dat)) ) + { + return u3m_bail(c3__exit); + } + else { + return _cqe_sha1(wid, dat); + } + } diff --git a/vere/pkg/noun/jets/e/shax.c b/vere/pkg/noun/jets/e/shax.c new file mode 100644 index 0000000..856d0fa --- /dev/null +++ b/vere/pkg/noun/jets/e/shax.c @@ -0,0 +1,194 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + + static u3_atom + _cqe_shay(u3_atom wid, + u3_atom dat) + { + c3_w len_w; + if ( !u3r_word_fit(&len_w, wid) ) { + return u3m_bail(c3__fail); + } + else { + c3_y out_y[32]; + c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); + urcrypt_shay(dat_y, len_w, out_y); + u3a_free(dat_y); + return u3i_bytes(32, out_y); + } + } + + static u3_atom + _cqe_shax(u3_atom a) + { + c3_w len_w; + c3_y out_y[32]; + c3_y* dat_y = u3r_bytes_all(&len_w, a); + urcrypt_shay(dat_y, len_w, out_y); + u3a_free(dat_y); + return u3i_bytes(32, out_y); + } + + static u3_atom + _cqe_shal(u3_atom wid, + u3_atom dat) + { + c3_w len_w; + if ( !u3r_word_fit(&len_w, wid) ) { + return u3m_bail(c3__fail); + } + else { + c3_y out_y[64]; + c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); + urcrypt_shal(dat_y, len_w, out_y); + u3a_free(dat_y); + return u3i_bytes(64, out_y); + } + } + + static u3_atom + _cqe_shas(u3_atom sal, + u3_atom ruz) + { + c3_w sal_w, ruz_w; + c3_y *sal_y, *ruz_y, out_y[32]; + + sal_y = u3r_bytes_all(&sal_w, sal); + ruz_y = u3r_bytes_all(&ruz_w, ruz); + urcrypt_shas(sal_y, sal_w, ruz_y, ruz_w, out_y); + u3a_free(sal_y); + u3a_free(ruz_y); + return u3i_bytes(32, out_y); + } + + u3_noun + u3we_shax(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqe_shax(a); + } + } + + u3_noun + u3we_shay(u3_noun cor) + { + u3_noun a, b; + + if ( (u3_none == (a = u3r_at(u3x_sam_2, cor))) || + (u3_none == (b = u3r_at(u3x_sam_3, cor))) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqe_shay(a, b); + } + } + + u3_noun + u3we_shal(u3_noun cor) + { + u3_noun a, b; + + if ( (u3_none == (a = u3r_at(u3x_sam_2, cor))) || + (u3_none == (b = u3r_at(u3x_sam_3, cor))) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqe_shal(a, b); + } + } + + u3_noun + u3we_shas(u3_noun cor) + { + u3_noun sal, ruz; + + if ( (u3_none == (sal = u3r_at(u3x_sam_2, cor))) || + (u3_none == (ruz = u3r_at(u3x_sam_3, cor))) || + (c3n == u3ud(sal)) || + (c3n == u3ud(ruz)) ) + { + return u3m_bail(c3__exit); + } else { + return _cqe_shas(sal, ruz); + } + } + + static u3_noun + _og_list(u3_noun a, + u3_noun b, + u3_noun c) + { + u3_noun l = u3_nul; + + if ( !_(u3a_is_cat(b)) ) { + return u3m_bail(c3__fail); + } + while ( 0 != b ) { + u3_noun x = u3qc_mix(a, c); + u3_noun y = u3qc_mix(b, x); + u3_noun d = _cqe_shas(c3_s4('o','g','-','b'), y); + u3_noun m; + + u3z(x); u3z(y); + + if ( b < 256 ) { + u3_noun e = u3qc_end(0, b, d); + + u3z(d); + m = u3nc(b, e); + b = 0; + } else { + m = u3nc(256, d); + c = d; + + b -= 256; + } + l = u3nc(m, l); + } + return u3kb_flop(l); + } + + u3_noun + u3qeo_raw(u3_atom a, + u3_atom b) + { + u3_noun x = u3qc_mix(b, a); + u3_noun c = _cqe_shas(c3_s4('o','g','-','a'), x); + u3_noun l = _og_list(a, b, c); + u3_noun r = u3qc_can(0, l); + + u3z(l); + u3z(c); + u3z(x); + + return r; + } + + u3_noun + u3weo_raw(u3_noun cor) + { + u3_noun a, b; + + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qeo_raw(a, b); + } + } diff --git a/vere/pkg/noun/jets/e/slaw.c b/vere/pkg/noun/jets/e/slaw.c new file mode 100644 index 0000000..906b0d7 --- /dev/null +++ b/vere/pkg/noun/jets/e/slaw.c @@ -0,0 +1,477 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +#include <ctype.h> + +static inline u3_noun +_parse_ud(u3_noun a) +{ + u3_weak pro; + + if ( u3_none == (pro = u3s_sift_ud(u3x_atom(a))) ) { + return u3_nul; + } + + return u3nc(u3_nul, pro); +} + +static +u3_noun get_syllable(c3_c** cur_ptr, c3_c* one, c3_c* two, c3_c* three) { + if (islower((*cur_ptr)[0]) && islower((*cur_ptr)[1]) && + islower((*cur_ptr)[2])) { + *one = (*cur_ptr)[0]; + *two = (*cur_ptr)[1]; + *three = (*cur_ptr)[2]; + (*cur_ptr) += 3; + return c3y; + } else { + return c3n; + } +} + +static u3_noun +combine(u3_noun p, u3_noun q) +{ + if ( (c3y == u3a_is_atom(p)) || (c3y == u3a_is_atom(q)) ) { + return 0; + } + + u3_noun lef = u3qa_mul(256, u3t(q)); + u3_noun ret = u3nc(0, u3qa_add(u3t(p), lef)); + u3z(lef); + u3z(p); u3z(q); + + return ret; +} + +#define ENSURE_NOT_END() do { \ + if (*cur == 0) { \ + u3a_free(c); \ + return u3_none; \ + } \ + } while (0) + +#define CONSUME(x) do { \ + if (*cur != x) { \ + u3a_free(c); \ + return u3_none; \ + } \ + cur++; \ + } while (0) + +#define TRY_GET_SYLLABLE(prefix) \ + c3_c prefix##_one, prefix##_two, prefix##_three; \ + if (c3n == get_syllable(&cur, & prefix##_one, & prefix##_two, & prefix##_three)) { \ + u3a_free(c); \ + return u3_none; \ + } + +u3_noun +_parse_p(u3_noun cor, u3_noun txt) { + c3_c* c = u3a_string(txt); + + c3_c* cur = c; + CONSUME('~'); + + // We at least have a sig prefix. We're now going to parse tuples of three + // lowercase letters. Our naming pattern for the pieces we read is [a b c d + // ...] as we read them. + TRY_GET_SYLLABLE(a); + + // There was only one syllable. If it's a valid suffix syllable, then + // it's a galaxy. We don't even have to run this through the scrambler or + // check for validity since its already a (unit @). + if (*cur == 0) { + u3a_free(c); + return u3_po_find_suffix(a_one, a_two, a_three); + } + + TRY_GET_SYLLABLE(b); + + // There were only two syllables. If they are a valid prefix and suffix, then + // it's a star. + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_atom combined = combine(b_part, a_part); + u3a_free(c); + return combined; + } + + // There must now be a - or it is invalid + CONSUME('-'); + + TRY_GET_SYLLABLE(c); + + ENSURE_NOT_END(); + + TRY_GET_SYLLABLE(d); + + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + + u3_noun m = combine(d_part, combine(c_part, combine(b_part, a_part))); + u3a_free(c); + + if (_(u3a_is_atom(m))) { + return 0; + } + + u3_atom raw = u3k(u3t(m)); + u3z(m); + + u3_noun ob = u3j_cook("u3we_slaw_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_slaw_fynd_p", ob, "fynd"); + return u3nc(0, u3n_slam_on(hok, raw)); + } + + // There must now be a - or it is invalid. + CONSUME('-'); + + // The next possible case is a "short" moon. (~ab-cd-ef) + TRY_GET_SYLLABLE(e); + + ENSURE_NOT_END(); + + TRY_GET_SYLLABLE(f); + + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + u3_noun e_part = u3_po_find_prefix(e_one, e_two, e_three); + u3_noun f_part = u3_po_find_suffix(f_one, f_two, f_three); + + u3_noun m = combine(f_part, combine(e_part, combine(d_part, + combine(c_part, combine(b_part, a_part))))); + u3a_free(c); + + if (_(u3a_is_atom(m))) { + return 0; + } + + u3_atom raw = u3k(u3t(m)); + u3z(m); + u3_noun ob = u3j_cook("u3we_slaw_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_slaw_fynd_p", ob, "fynd"); + return u3nc(0, u3n_slam_on(hok, raw)); + } + + // There must now be a - or it is invalid. + CONSUME('-'); + + // The next possible case is a "long" moon. (~ab-cd-ef-gh) + TRY_GET_SYLLABLE(g); + + ENSURE_NOT_END(); + + TRY_GET_SYLLABLE(h); + + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + u3_noun e_part = u3_po_find_prefix(e_one, e_two, e_three); + u3_noun f_part = u3_po_find_suffix(f_one, f_two, f_three); + u3_noun g_part = u3_po_find_prefix(g_one, g_two, g_three); + u3_noun h_part = u3_po_find_suffix(h_one, h_two, h_three); + + u3_noun m = combine(h_part, combine(g_part, combine(f_part, + combine(e_part, combine(d_part, combine(c_part, + combine(b_part, a_part))))))); + u3a_free(c); + + if (_(u3a_is_atom(m))) { + return 0; + } + + u3_atom raw = u3k(u3t(m)); + u3z(m); + u3_noun ob = u3j_cook("u3we_slaw_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_slaw_fynd_p", ob, "fynd"); + return u3nc(0, u3n_slam_on(hok, raw)); + } + + // At this point, the only thing it could be is a long comet, of the form + // ~ab-cd-ef-gh--ij-kl-mn-op + + CONSUME('-'); + CONSUME('-'); + + TRY_GET_SYLLABLE(i); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(j); + CONSUME('-'); + TRY_GET_SYLLABLE(k); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(l); + CONSUME('-'); + TRY_GET_SYLLABLE(m); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(n); + CONSUME('-'); + TRY_GET_SYLLABLE(o); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(p); + + if (*cur != 0) { + // We've parsed all of a comet shape, and there's still more in the + // string. Bail back to the interpreter. + u3a_free(c); + return u3_none; + } + + // We have a long comet. Time to jam it all together. We rely on combine() + // for the error checking and we don't have to scramble comet names. + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + u3_noun e_part = u3_po_find_prefix(e_one, e_two, e_three); + u3_noun f_part = u3_po_find_suffix(f_one, f_two, f_three); + u3_noun g_part = u3_po_find_prefix(g_one, g_two, g_three); + u3_noun h_part = u3_po_find_suffix(h_one, h_two, h_three); + u3_noun i_part = u3_po_find_prefix(i_one, i_two, i_three); + u3_noun j_part = u3_po_find_suffix(j_one, j_two, j_three); + u3_noun k_part = u3_po_find_prefix(k_one, k_two, k_three); + u3_noun l_part = u3_po_find_suffix(l_one, l_two, l_three); + u3_noun m_part = u3_po_find_prefix(m_one, m_two, m_three); + u3_noun n_part = u3_po_find_suffix(n_one, n_two, n_three); + u3_noun o_part = u3_po_find_prefix(o_one, o_two, o_three); + u3_noun p_part = u3_po_find_suffix(p_one, p_two, p_three); + + u3a_free(c); + + return combine(p_part, combine(o_part, combine(n_part, combine(m_part, + combine(l_part, combine(k_part, combine(j_part, combine(i_part, + combine(h_part, combine(g_part, combine(f_part, combine(e_part, + combine(d_part, combine(c_part, combine(b_part, a_part))))))))))))))); +} + +#define PARSE_NONZERO_NUMBER(numname) \ + c3_w numname = 0; \ + do { \ + if (cur[0] > '9' || cur[0] < '1') { \ + u3a_free(c); \ + return u3_none; \ + } \ + numname = cur[0] - '0'; \ + cur++; \ + while (isdigit(cur[0])) { \ + numname = u3ka_mul(numname, 10); \ + numname = u3ka_add(numname, cur[0] - '0'); \ + cur++; \ + } \ + } while (0) + +#define PARSE_INCLUDING_ZERO_NUMBER(numname) \ + c3_w numname = 0; \ + do { \ + if (cur[0] > '9' || cur[0] < '0') { \ + u3a_free(c); \ + return u3_none; \ + } \ + numname = cur[0] - '0'; \ + cur++; \ + while (isdigit(cur[0])) { \ + numname = u3ka_mul(numname, 10); \ + numname = u3ka_add(numname, cur[0] - '0'); \ + cur++; \ + } \ + } while (0) + +#define PARSE_HEX_DIGIT(out) \ + do { \ + if (cur[0] >= '0' && cur[0] <= '9') { \ + out = cur[0] - '0'; \ + } else if (cur[0] >= 'a' && cur[0] <= 'f') { \ + out = 10 + cur[0] - 'a'; \ + } else { \ + u3a_free(c); \ + return u3_none; \ + } \ + cur++; \ + } while(0) + + +u3_noun +_parse_da(u3_noun cor, u3_noun txt) { + c3_c* c = u3a_string(txt); + + c3_c* cur = c; + CONSUME('~'); + + // Parse out an arbitrary year number. Starts with a nonzero digit followed + // by a series of any digits. + PARSE_NONZERO_NUMBER(year); + + // Parse the optional negative sign for BC dates. + u3_noun bc = c3y; + if (cur[0] == '-') { + bc = c3n; + cur++; + } + + CONSUME('.'); + + // Parse out a two digit month (mot:ag). Either a single digit 1-9 or 1[012]. + c3_y month; + if (cur[0] == '1') { + if (cur[1] <= '2' && cur[1] >= '0') { + // This is a two number month. + month = 10 + cur[1] - '0'; + cur += 2; + } else { + // This is January. + month = 1; + cur++; + } + } else if (cur[0] <= '9' && cur[0] >= '2') { + month = cur[0] - '0'; + cur++; + } else { + u3a_free(c); + return u3_none; + } + + CONSUME('.'); + + // Parse out a two digit day (dip:ag). This number can be really big, so we + // can track number of days since September 1993. + PARSE_NONZERO_NUMBER(day); + + if (cur[0] == 0) { + u3a_free(c); + u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); + u3_noun res = u3n_slam_on(hok, + u3nt(u3nc(bc, year), month, + u3nc(day, u3nq(0, 0, 0, 0)))); + return u3nc(0, res); + } + + CONSUME('.'); + CONSUME('.'); + + PARSE_INCLUDING_ZERO_NUMBER(hour); + CONSUME('.'); + PARSE_INCLUDING_ZERO_NUMBER(minute); + CONSUME('.'); + PARSE_INCLUDING_ZERO_NUMBER(second); + + if (cur[0] == 0) { + u3a_free(c); + u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); + u3_noun res = u3n_slam_on(hok, + u3nt(u3nc(bc, year), month, + u3nc(day, u3nq(hour, minute, second, 0)))); + return u3nc(0, res); + } + + CONSUME('.'); + CONSUME('.'); + + // Now we have to parse a list of hexidecimal numbers 0-f of length 4 only + // (zero padded otherwise) separated by dots. + u3_noun list = 0; + while (1) { + // Parse 4 hex digits + c3_y one, two, three, four; + PARSE_HEX_DIGIT(one); + PARSE_HEX_DIGIT(two); + PARSE_HEX_DIGIT(three); + PARSE_HEX_DIGIT(four); + + c3_w current = (one << 12) + (two << 8) + (three << 4) + four; + list = u3nc(u3i_words(1, ¤t), list); + + if (cur[0] == 0) { + u3a_free(c); + + u3_noun flopped = u3qb_flop(list); + u3z(list); + + u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); + u3_noun res = u3n_slam_on(hok, + u3nt(u3nc(bc, year), month, + u3nc(day, + u3nq(hour, minute, second, flopped)))); + return u3nc(0, res); + } + + CONSUME('.'); + } +} + +#undef ENSURE_NOT_END +#undef CONSUME +#undef TRY_GET_SYLLABLE +#undef PARSE_NONZERO_NUMBER +#undef PARSE_HEX_DIGIT + +u3_noun +_parse_tas(u3_noun txt) { + // For any symbol which matches, txt will return itself as a + // value. Therefore, this is mostly checking validity. + c3_c* c = u3a_string(txt); + + // First character must represent a lowercase letter + c3_c* cur = c; + if (!islower(cur[0])) { + u3a_free(c); + return 0; + } + cur++; + + while (cur[0] != 0) { + if (!(islower(cur[0]) || isdigit(cur[0]) || cur[0] == '-')) { + u3a_free(c); + return 0; + } + + cur++; + } + + u3a_free(c); + return u3nc(0, u3k(txt)); +} + +u3_noun +u3we_slaw(u3_noun cor) +{ + u3_noun mod; + u3_noun txt; + + if (c3n == u3r_mean(cor, u3x_sam_2, &mod, + u3x_sam_3, &txt, 0)) { + return u3m_bail(c3__exit); + } + + switch (mod) { + case c3__da: + return _parse_da(cor, txt); + + case 'p': + return _parse_p(cor, txt); + + case c3__ud: + return _parse_ud(txt); + + // %ta is used once in link.hoon. don't bother. + + case c3__tas: + return _parse_tas(txt); + + default: + return u3_none; + } +} diff --git a/vere/pkg/noun/jets/e/tape.c b/vere/pkg/noun/jets/e/tape.c new file mode 100644 index 0000000..4d251b6 --- /dev/null +++ b/vere/pkg/noun/jets/e/tape.c @@ -0,0 +1,53 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + static u3_noun + _norm(u3_noun a) + { + if ( c3n == u3du(a) ) { + return u3_nul; + } else { + return u3nc(((c3y == u3du(u3h(a))) ? u3_nul : u3k(u3h(a))), + _norm(u3t(a))); + } + } + + static u3_noun + _good(u3_noun a) + { + while ( 1 ) { + if ( u3_nul == a ) { + return c3y; + } + if ( c3n == u3ud(u3h(a)) ) { + return c3n; + } + a = u3t(a); + } + } + + u3_noun + u3qe_tape(u3_noun a) + { + if ( c3y == _good(a) ) { + return u3k(a); + } else { + return _norm(a); + } + } + u3_noun + u3we_tape(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ) { + return u3m_bail(c3__fail); + } else { + return u3qe_tape(a); + } + } diff --git a/vere/pkg/noun/jets/e/trip.c b/vere/pkg/noun/jets/e/trip.c new file mode 100644 index 0000000..519a852 --- /dev/null +++ b/vere/pkg/noun/jets/e/trip.c @@ -0,0 +1,33 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qe_trip(u3_atom a) +{ + return u3qc_rip(3, 1, a); +} + +u3_noun +u3we_trip(u3_noun cor) +{ + u3_noun a = u3x_at(u3x_sam, cor); + + if ( c3n == u3ud(a) ) { + return u3m_bail(c3__exit); + } + + return u3qe_trip(a); +} + +u3_atom +u3ke_trip(u3_noun a) +{ + u3_atom pro = u3qe_trip(a); + u3z(a); + return pro; +} diff --git a/vere/pkg/noun/jets/e/urwasm.c b/vere/pkg/noun/jets/e/urwasm.c new file mode 100644 index 0000000..626aef3 --- /dev/null +++ b/vere/pkg/noun/jets/e/urwasm.c @@ -0,0 +1,3086 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +#include "wasm3.h" +#include "m3_env.h" + +// #define URWASM_SUBROAD +#define URWASM_STATEFUL + +#define ONCE_CTX 63 +#define RUN_CTX 7 + +#define AX_RUNNABLE 374 +#define AX_ARROWS 1502 + +#define AX_CALL 20 +#define AX_MEMREAD 383 +#define AX_MEMWRITE 94 +#define AX_CALL_EXT 375 +#define AX_GLOBAL_SET 4 +#define AX_GLOBAL_GET 22 +#define AX_MEM_SIZE 186 +#define AX_MEM_GROW 381 +#define AX_GET_ACC 374 +#define AX_SET_ACC 92 +#define AX_GET_ALL_GLOB 43 +#define AX_SET_ALL_GLOB 380 + +#define AX_TRY 43 +#define AX_CATCH 4 +#define AX_RETURN 20 +#define AX_FAIL 47 + +#define ARROW_CTX 511 +#define MONAD_CTX 127 + +#define arr_sam 62 +#define arr_sam_2 124 +#define arr_sam_3 125 +#define arr_sam_6 250 +#define arr_sam_7 251 + +#define seed_module 2 +#define seed_past 6 +#define seed_shop 14 +#define seed_import 15 + +#define uw__lia c3_s3('l', 'i', 'a') + +#define uw_lia_run_version 1 + +#define ERR(string) ("\r\n\033[31m>>> " string "\033[0m\r\n") +#define WUT(string) ("\r\n\033[33m>> " string "\033[0m\r\n") +#define DBG(string) ("\r\n" string "\r\n") + +#define KICK1(TRAP) uw_kick_nock(TRAP, 2) +#define KICK2(TRAP) KICK1(KICK1(TRAP)) + +// [a b c d e f g h] +static inline u3_noun +uw_octo(u3_noun a, + u3_noun b, + u3_noun c, + u3_noun d, + u3_noun e, + u3_noun f, + u3_noun g, + u3_noun h) +{ + return u3nc(a, u3nq(b, c, d, u3nq(e, f, g, h))); +} + +// kick by nock. axe RETAINED (ignore if direct) +static u3_noun +uw_kick_nock(u3_noun cor, u3_noun axe) +{ + u3_noun fol = u3x_at(axe, cor); + return u3n_nock_on(cor, u3k(fol)); +} + +// slam by nock +static u3_noun +uw_slam_nock(u3_noun gat, u3_noun sam) +{ + u3_noun cor = u3nc(u3k(u3h(gat)), u3nc(sam, u3k(u3t(u3t(gat))))); + u3z(gat); + return uw_kick_nock(cor, 2); +} + +static u3_noun +uw_slam_check(u3_noun gat, u3_noun sam, c3_t is_stateful) +{ + u3_noun bat = u3k(u3h(gat)); + u3_noun cor = u3nc(u3k(bat), u3nc(sam, u3k(u3t(u3t(gat))))); + u3z(gat); + + if (!is_stateful) + { + return u3n_nock_on(cor, bat); + } + else + { + u3_noun ton = u3n_nock_an(cor, bat); + + u3_noun tag, pro; + if (c3n == u3r_cell(ton, &tag, &pro)) + { + return u3m_bail(c3__fail); + } + if (0 == tag) + { + u3k(pro); + u3z(ton); + return pro; + } + else if (2 == tag) + { + return u3m_bail(c3__exit); + } + else + { + return u3m_bail(c3__fail); + } + } +} + +static inline void +_push_list(u3_noun som, u3_noun *lit) +{ + if (u3_none == *lit) + { + u3z(som); + } + else + { + *lit = u3nc(som, *lit); + } +} + +static inline u3_weak +_pop_list(u3_weak *lit) +{ + if (u3_none == *lit) + { + return u3_none; + } + u3_noun hed, tel; + if (c3n == u3r_cell(*lit, &hed, &tel)) + { + return u3m_bail(c3__fail); + } + u3k(hed); + u3k(tel); + u3z(*lit); + *lit = tel; + return hed; +} + +static const M3Result UrwasmArrowExit = "An imported arrow returned %2"; + +static const c3_m uw_run_m = uw__lia + c3__run + uw_lia_run_version; + +static_assert( + (c3y == u3a_is_cat(uw_run_m)), + "u3we_run key tag must be a direct atom" +); + +typedef struct { + u3_noun call_bat; + u3_noun memread_bat; + u3_noun memwrite_bat; + u3_noun call_ext_bat; + u3_noun try_bat; + u3_noun catch_bat; + u3_noun return_bat; + u3_noun fail_bat; + u3_noun global_set_bat; + u3_noun global_get_bat; + u3_noun mem_grow_bat; + u3_noun mem_size_bat; + u3_noun get_acc_bat; + u3_noun set_acc_bat; + u3_noun get_all_glob_bat; + u3_noun set_all_glob_bat; +// + u3_noun call_ctx; + u3_noun memread_ctx; + u3_noun memwrite_ctx; + u3_noun global_set_ctx; + u3_noun global_get_ctx; + u3_noun mem_grow_ctx; + u3_noun mem_size_ctx; + u3_noun get_all_glob_ctx; + u3_noun set_all_glob_ctx; +} match_data_struct; + +// memory arena with exponential growth +typedef struct { + c3_w siz_w; // size in bytes + c3_y pad_y; // alignment padding + c3_t ini_t; // already initialized + u3i_slab sab_u; // associated slab + c3_y* buf_y; // allocated buffer + c3_y* nex_y; // next allocation + c3_y* end_y; // end of arena + jmp_buf* esc_u; // escape buffer +} uw_arena; + +typedef struct { + IM3Module wasm_module; // p + u3_noun lia_shop; // q, transferred + u3_noun acc; // p.r, transferred + u3_noun map; // q.r, retained + match_data_struct* match; + u3_noun arrow_yil; // transferred + u3_noun susp_list; // transferred + u3_noun resolution; // resolved %1 block, transferred + uw_arena box_arena; + uw_arena code_arena; + u3_noun yil_previous; // transferred + u3_noun queue; // transferred + c3_t is_stateful; +} lia_state; + +typedef enum { + west_call, + west_call_ext, + west_try, + west_catch_try, + west_catch_err, + west_link_wasm, +} wasm3_ext_suspend_tag; + +typedef enum { + lst_call = 0, + // lst_call_ext = 1, // not necessary + lst_try = 2, + lst_catch_try = 3, + lst_catch_err = 4, + lst_link_wasm = 5, +} lia_suspend_tag; + +static void +_uw_arena_init_size(uw_arena* ren_u, c3_w siz_w) +{ + ren_u->siz_w = siz_w; + u3i_slab_init(&ren_u->sab_u, 3, siz_w + 12); // size + max padding + ren_u->buf_y = ren_u->nex_y = c3_align(ren_u->sab_u.buf_y, 16, C3_ALGHI); + ren_u->end_y = ren_u->buf_y + ren_u->siz_w; + c3_y pad_y = ren_u->buf_y - ren_u->sab_u.buf_y; + if (pad_y > 12) + { + u3m_bail(c3__fail); + } + ren_u->pad_y = pad_y; + ren_u->ini_t = 1; +} + +static void +_uw_arena_init(uw_arena* ren_u) +{ + _uw_arena_init_size(ren_u, (c3_w)1 << 23); +} + +static void +_uw_arena_grow(uw_arena* ren_u) +{ + if (!ren_u->ini_t) + { + u3m_bail(c3__fail); + } + c3_w new_w = ren_u->siz_w * 2; + if (new_w / 2 != ren_u->siz_w) + { + u3m_bail(c3__fail); + } + ren_u->siz_w = new_w; + + u3i_slab_free(&ren_u->sab_u); + + u3i_slab_init(&ren_u->sab_u, 3, new_w + 12); // size + max padding + ren_u->buf_y = ren_u->nex_y = c3_align(ren_u->sab_u.buf_y, 16, C3_ALGHI); + ren_u->end_y = ren_u->nex_y + new_w; + c3_y pad_y = ren_u->nex_y - ren_u->sab_u.buf_y; + if (pad_y > 12) + { + u3m_bail(c3__fail); + } + ren_u->pad_y = pad_y; +} + +static void +_uw_arena_reset(uw_arena* ren_u) +{ + if (!ren_u->ini_t) + { + u3m_bail(c3__fail); + } + ren_u->nex_y = ren_u->buf_y; + memset(ren_u->buf_y, 0, (size_t)ren_u->siz_w); +} + +static void +_uw_arena_free(uw_arena* ren_u) +{ + if (!ren_u->ini_t) + { + u3m_bail(c3__fail); + } + u3i_slab_free(&ren_u->sab_u); + ren_u->ini_t = 0; +} + +// Code page allocation: simple bump allocator for non-growing objects, +// i.e. code pages +// save allocation length for realloc +// CodeArena->esc_u MUST be initialized by the caller to handle OOM +// +static uw_arena* CodeArena; + +static void* +_calloc_code(size_t num_i, size_t len_i) +{ + if (!CodeArena->ini_t) + { + u3m_bail(c3__fail); + } + + void* lag_v = CodeArena->nex_y; + + size_t byt_i = num_i * len_i; + if (byt_i / len_i != num_i) + { + u3m_bail(c3__fail); + } + + if (byt_i >= UINT64_MAX - 16) + { + u3m_bail(c3__fail); + } + c3_d byt_d = byt_i + 16; // c3_d for length + alignment padding + + c3_y* nex_y = CodeArena->nex_y + byt_d; + nex_y = c3_align(nex_y, 16, C3_ALGHI); + + if (nex_y >= CodeArena->end_y) + { // OOM, jump out to increase the arena size and try again + _longjmp(*CodeArena->esc_u, c3__code); + } + + *((c3_d*)lag_v) = byt_d - 16; // corruption check + *((c3_d*)lag_v + 1) = byt_d - 16; + + CodeArena->nex_y = nex_y; + return ((c3_d*)lag_v + 2); +} + +static void* +_realloc_code(void* lag_v, size_t len_i) +{ + if (!CodeArena->ini_t) + { + u3m_bail(c3__fail); + } + if (!lag_v) + { + return _calloc_code(len_i, 1); + } + c3_d old1_d = *((c3_d*)lag_v - 1); + c3_d old2_d = *((c3_d*)lag_v - 2); + if (old1_d != old2_d) + { + u3m_bail(c3__fail); + } + if (len_i >= UINT64_MAX) + { + u3m_bail(c3__fail); + } + c3_d len_d = len_i; + void* new_v = _calloc_code(len_d, 1); + memcpy(new_v, lag_v, c3_min(len_d, old1_d)); + + return new_v; +} + +static void +_free_code(void* lag_v) +{ + if (!CodeArena->ini_t) + { + u3m_bail(c3__fail); + } + // noop +} + +// Struct/array allocation: [len_d cap_d data] +// BoxArena->esc_u MUST be initialized by the caller to handle OOM +// +static uw_arena* BoxArena; + +// allocate with capacity +// the allocated buffer +static void* +_malloc_box_cap(c3_d len_d, c3_d cap_d) +{ + if (!BoxArena->ini_t) + { + u3m_bail(c3__fail); + } + + void* lag_v = BoxArena->nex_y; + + if (cap_d >= UINT64_MAX - 16) + { + u3m_bail(c3__fail); + } + c3_d pac_d = cap_d + 16; // c3_d for length + capacity + + c3_y* nex_y = BoxArena->nex_y + pac_d; + nex_y = c3_align(nex_y, 16, C3_ALGHI); + + if (nex_y >= BoxArena->end_y) + { // OOM, jump out to increase the arena size and try again + _longjmp(*BoxArena->esc_u, c3__box); + } + + *((c3_d*)lag_v) = len_d; + *((c3_d*)lag_v + 1) = cap_d; + + BoxArena->nex_y = nex_y; + return ((c3_d*)lag_v + 2); +} + +static void* +_calloc_box(size_t num_i, size_t len_i) +{ + size_t byt_i = num_i * len_i; + if (byt_i / len_i != num_i) + { + u3m_bail(c3__fail); + } + if (byt_i > UINT64_MAX - 16) + { + u3m_bail(c3__fail); + } + c3_d byt_d = byt_i; + return _malloc_box_cap(byt_d, byt_d); +} + +static void* +_realloc_box(void* lag_v, size_t len_i) +{ + if (!BoxArena->ini_t) + { + u3m_bail(c3__fail); + } + if (!lag_v) + { + return _calloc_box(len_i, 1); + } + c3_d old_d = *((c3_d*)lag_v - 2); + c3_d cap_d = *((c3_d*)lag_v - 1); + if (len_i >= UINT64_MAX) + { + u3m_bail(c3__fail); + } + c3_d len_d = len_i; + if (len_d <= cap_d) + { + *((c3_d*)lag_v - 2) = len_d; + return lag_v; + } + + // while (cap_d <= len_d) + // { + // cap_d *= 2; + // } + cap_d <<= c3_bits_dabl(len_d) - c3_bits_dabl(cap_d); + cap_d <<= (cap_d <= len_d); + + // overflow check + if (cap_d <= len_d) + u3m_bail(c3__fail); + + void* new_v = _malloc_box_cap(len_d, cap_d); + memcpy(new_v, lag_v, old_d); + + return new_v; +} + +static void +_free_box(void* lag_v) +{ + if (!BoxArena->ini_t) + { + u3m_bail(c3__fail); + } + // noop +} + +// bailing allocator to prevent wasm3 from touching the arenas + +static void* +_calloc_bail(size_t num_i, size_t len_i) +{ + u3m_bail(c3__fail); +} + +static void* +_realloc_bail(void* lag_v, size_t len_i) +{ + u3m_bail(c3__fail); +} + +static void +_free_bail(void* lag_v) +{ + u3m_bail(c3__fail); +} + + +static u3_noun +_atoms_from_stack(void** valptrs, c3_w n, c3_y* types) +{ + u3_noun out = u3_nul; + while (n--) + { + switch (types[n]) + { // TODO 64 bit vere + case c_m3Type_i32: + case c_m3Type_f32: + { + out = u3nc(u3i_word(*(c3_w*)valptrs[n]), out); + break; + } + case c_m3Type_i64: + case c_m3Type_f64: + { + out = u3nc(u3i_chub(*(c3_d*)valptrs[n]), out); + break; + } + default: + { + return u3m_bail(c3__fail); + } + } + } + return out; +} + +// RETAIN argument +static c3_o +_atoms_to_stack(u3_noun atoms, void** valptrs, c3_w n, c3_y* types) +{ + for (c3_w i = 0; i < n; i++) + { + if (c3y == u3ud(atoms)) + { + return c3n; + } + u3_noun atom; + u3x_cell(atoms, &atom, &atoms); + if (c3n == u3ud(atom)) + { + return u3m_bail(c3__fail); + } + switch (types[i]) + { + case c_m3Type_i32: + case c_m3Type_f32: + { + *(c3_w*)valptrs[i] = u3r_word(0, atom); + break; + } + case c_m3Type_i64: + case c_m3Type_f64: + { + *(c3_d*)valptrs[i] = u3r_chub(0, atom); + break; + } + default: + { + return u3m_bail(c3__fail); + } + } + } + return __(u3_nul == atoms); +} + +static u3_noun +_coins_from_stack(void** valptrs, c3_w n, c3_y* types) +{ + u3_noun out = u3_nul; + while (n--) + { + switch (types[n]) + { // TODO 64 bit vere + case c_m3Type_i32: + { + out = u3nc(u3nc(c3__i32, u3i_word(*(c3_w*)valptrs[n])), out); + break; + } + case c_m3Type_i64: + { + out = u3nc(u3nc(c3__i64, u3i_chub(*(c3_d*)valptrs[n])), out); + break; + } + case c_m3Type_f32: + { + out = u3nc(u3nc(c3__f32, u3i_word(*(c3_w*)valptrs[n])), out); + break; + } + case c_m3Type_f64: + { + out = u3nc(u3nc(c3__f64, u3i_chub(*(c3_d*)valptrs[n])), out); + break; + } + default: + { + return u3m_bail(c3__fail); + } + } + } + return out; +} + +// RETAIN argument +static c3_o +_coins_to_stack(u3_noun coins, void** valptrs, c3_w n, c3_y* types) +{ + for (c3_w i = 0; i < n; i++) + { + if (c3y == u3ud(coins)) + { + return c3n; + } + u3_noun coin; + u3x_cell(coins, &coin, &coins); + if (c3y == u3ud(coin)) + { + return u3m_bail(c3__fail); + } + u3_noun tag, value; + u3x_cell(coin, &tag, &value); + if (c3n == u3ud(value)) + { + return u3m_bail(c3__fail); + } + switch (types[i]) + { + case c_m3Type_i32: + { + if (c3__i32 != tag) + { + return c3n; + } + *(c3_w*)valptrs[i] = u3r_word(0, value); + break; + } + case c_m3Type_i64: + { + if (c3__i64 != tag) + { + return c3n; + } + *(c3_d*)valptrs[i] = u3r_chub(0, value); + break; + } + case c_m3Type_f32: + { + if (c3__f32 != tag) + { + return c3n; + } + *(c3_w*)valptrs[i] = u3r_word(0, value); + break; + } + case c_m3Type_f64: + { + if (c3__f64 != tag) + { + return c3n; + } + *(c3_d*)valptrs[i] = u3r_chub(0, value); + break; + } + default: + { + return u3m_bail(c3__fail); + } + } + } + return __(u3_nul == coins); +} + +static c3_t +_deterministic_trap(M3Result result) +{ + return ( result == m3Err_trapOutOfBoundsMemoryAccess + || result == m3Err_trapDivisionByZero + || result == m3Err_trapIntegerOverflow + || result == m3Err_trapIntegerConversion + || result == m3Err_trapIndirectCallTypeMismatch + || result == m3Err_trapTableIndexOutOfRange + || result == m3Err_trapTableElementIsNull + || result == UrwasmArrowExit + ); +} + +static u3_noun +_reduce_monad(u3_noun monad, lia_state* sat_u) +{ + u3_noun monad_bat = u3h(monad); + if (c3y == u3r_sing(monad_bat, sat_u->match->call_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->call_ctx)) + { + return u3m_bail(c3__fail); + } + // call + u3_atom name = u3x_atom(u3at(arr_sam_2, monad)); + u3_noun args = u3at(arr_sam_3, monad); + + c3_w met_w = u3r_met(3, name); + c3_c* name_c = u3a_malloc(met_w + 1); + u3r_bytes(0, met_w, (c3_y*)name_c, name); + name_c[met_w] = 0; + + M3Result result; + + IM3Function f; + result = m3_FindFunction(&f, sat_u->wasm_module->runtime, name_c); + + if (result) + { + fprintf(stderr, ERR("function %s search error: %s"), name_c, result); + return u3m_bail(c3__fail); + } + + c3_w n_in = f->funcType->numArgs; + c3_w n_out = f->funcType->numRets; + c3_y* types = f->funcType->types; + + c3_d *vals_in = u3a_calloc(n_in, sizeof(c3_d)); + void **valptrs_in = u3a_calloc(n_in, sizeof(void*)); + for (c3_w i = 0; i < n_in; i++) + { + valptrs_in[i] = &vals_in[i]; + } + + c3_d *vals_out = u3a_calloc(n_out, sizeof(c3_d)); + void **valptrs_out = u3a_calloc(n_out, sizeof(void*)); + for (c3_w i = 0; i < n_out; i++) + { + valptrs_out[i] = &vals_out[i]; + } + + if (c3n == _atoms_to_stack(args, valptrs_in, n_in, (types+n_out))) + { + fprintf(stderr, ERR("function %s wrong number of args"), name_c); + return u3m_bail(c3__fail); + } + + c3_w edge_1 = sat_u->wasm_module->runtime->edge_suspend; + + // printf("\r\n\r\n invoke %s\r\n\r\n", name_c); + + { // push on suspend stacks + c3_d f_idx_d = f - sat_u->wasm_module->functions; + m3_SuspendStackPush64(sat_u->wasm_module->runtime, f_idx_d); + m3_SuspendStackPush64(sat_u->wasm_module->runtime, west_call); + m3_SuspendStackPushExtTag(sat_u->wasm_module->runtime); + _push_list( + u3nc(lst_call, u3k(name)), + &sat_u->susp_list + ); + } + + M3Result result_call = m3_Call(f, n_in, (const void**)valptrs_in); + // printf("\r\n done %s\r\n", name_c); + + if (result_call != m3Err_ComputationBlock + && result_call != m3Err_SuspensionError) + { // pop suspend stacks + m3_SuspendStackPopExtTag(sat_u->wasm_module->runtime); + c3_d tag; + m3_SuspendStackPop64(sat_u->wasm_module->runtime, &tag); + if (tag != -1 && tag != west_call) + { + printf(ERR("call tag mismatch: %"PRIc3_d), tag); + return u3m_bail(c3__fail); + } + m3_SuspendStackPop64(sat_u->wasm_module->runtime, NULL); + u3_noun frame = _pop_list(&sat_u->susp_list); + if (u3_none != frame && lst_call != u3h(frame)) + { + printf(ERR("wrong frame: call")); + return u3m_bail(c3__fail); + } + u3z(frame); + } + + u3_noun yil; + if (result_call == m3Err_ComputationBlock) + { + yil = sat_u->arrow_yil; + sat_u->arrow_yil = u3_none; + if (yil == u3_none) + { + return u3m_bail(c3__fail); + } + } + else if (_deterministic_trap(result_call)) + { + fprintf(stderr, WUT("%s call trapped: %s"), name_c, result_call); + yil = u3nc(2, 0); + } + else if (result_call == m3Err_functionImportMissing) + { + return u3m_bail(c3__exit); + } + else if (result_call) + { + fprintf(stderr, ERR("%s call failed: %s"), name_c, result_call); + return u3m_bail(c3__fail); + } + else + { + result = m3_GetResults(f, n_out, (const void**)valptrs_out); + if (result) + { + fprintf(stderr, ERR("function %s failed to get results"), name_c); + return u3m_bail(c3__fail); + } + yil = u3nc(0, _atoms_from_stack(valptrs_out, n_out, types)); + } + + c3_w edge_2 = sat_u->wasm_module->runtime->edge_suspend; + if (edge_1 != edge_2 && !result_call) + { + fprintf(stderr, ERR("imbalanced suspension stack on succesfull return: %d vs %d"), edge_1, edge_2); + return u3m_bail(c3__fail); + } + + u3a_free(name_c); + u3a_free(vals_in); + u3a_free(valptrs_in); + u3a_free(vals_out); + u3a_free(valptrs_out); + u3z(monad); + + return yil; + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->memread_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->memread_ctx)) + { + return u3m_bail(c3__fail); + } + // memread + u3_atom ptr = u3x_atom(u3at(arr_sam_2, monad)); + u3_noun len = u3at(arr_sam_3, monad); + + c3_w ptr_w = u3r_word(0, ptr); + c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); + c3_w len_buf_w; + c3_y* buf_y = m3_GetMemory(sat_u->wasm_module->runtime, &len_buf_w, 0); + + if (buf_y == NULL) + { + fprintf(stderr, ERR("memread failed to get memory")); + return u3m_bail(c3__fail); + } + + if (ptr_w + len_l > len_buf_w) + { + fprintf(stderr, ERR("memread out of bounds")); + return u3m_bail(c3__fail); + } + + u3z(monad); + return u3nt(0, len_l, u3i_bytes(len_l, (buf_y + ptr_w))); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->memwrite_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->memwrite_ctx)) + { + return u3m_bail(c3__fail); + } + // memwrite + u3_atom ptr = u3x_atom(u3at(arr_sam_2, monad)); + u3_noun len = u3at(arr_sam_6, monad); + u3_noun src = u3at(arr_sam_7, monad); + + c3_w ptr_w = u3r_word(0, ptr); + c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); + + c3_w len_buf_w; + c3_y* buf_y = m3_GetMemory(sat_u->wasm_module->runtime, &len_buf_w, 0); + + if (buf_y == NULL) + { + fprintf(stderr, ERR("memwrite failed to get memory")); + return u3m_bail(c3__fail); + } + + if (ptr_w + len_l > len_buf_w) + { + fprintf(stderr, ERR("memwrite out of bounds")); + return u3m_bail(c3__fail); + } + + u3r_bytes(0, len_l, (buf_y + ptr_w), u3x_atom(src)); + + u3z(monad); + return u3nc(0, 0); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->call_ext_bat)) + { + // call-ext + if (u3_nul == sat_u->lia_shop) + { + // Suspended computation will have exactly one blocking point, which + // must be at the top of the stack. You are at this point. + // There is no useful info to be saved here, name/args are not enough + // to qualify the external call, which can and will be nondeterministic + // (like all IO in urbit) + // + // On wasm3 side op_CallRaw will store the information about the + // called function. It shall be the top frame of the suspension stack, + // since only Lia can block, so wasm3 has to call Lia to get blocked. + // + // A frame is pushed in wasm3 to trigger the callback and signal to + // _apply_diff that the computation is blocked + // + m3_SuspendStackPush64(sat_u->wasm_module->runtime, west_call_ext); + m3_SuspendStackPushExtTag(sat_u->wasm_module->runtime); + + u3_noun name = u3at(arr_sam_2, monad); + u3_noun args = u3at(arr_sam_3, monad); + + u3_noun yil = u3nt(1, u3k(name), u3k(args)); + u3z(monad); + return yil; + } + else + { + u3z(monad); + + u3_noun lia_buy, tel; + u3x_cell(sat_u->lia_shop, &lia_buy, &tel); + u3_noun yil = u3nc(0, u3k(lia_buy)); + u3k(tel); + u3z(sat_u->lia_shop); + sat_u->lia_shop = tel; + return yil; + } + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->try_bat)) + { + // try + u3_noun monad_b = u3at(60, monad); + u3_noun cont = u3at(61, monad); + u3_weak yil; + u3_noun monad_cont; + { // push on suspend stacks + m3_SuspendStackPush64(sat_u->wasm_module->runtime, west_try); + m3_SuspendStackPushExtTag(sat_u->wasm_module->runtime); + _push_list(u3nc(lst_try, u3k(cont)), &sat_u->susp_list); + } + { + yil = _reduce_monad(u3k(monad_b), sat_u); + + if (1 != u3h(yil)) + { // pop suspend stacks + m3_SuspendStackPopExtTag(sat_u->wasm_module->runtime); + c3_d tag; + m3_SuspendStackPop64(sat_u->wasm_module->runtime, &tag); + if (tag != -1 && tag != west_try) + { + printf(ERR("try tag mismatch: %"PRIc3_d), tag); + return u3m_bail(c3__fail); + } + u3_noun frame = _pop_list(&sat_u->susp_list); + if (u3_none != frame && lst_try != u3h(frame)) + { + printf(ERR("wrong frame: try")); + return u3m_bail(c3__fail); + } + u3z(frame); + } + + if (0 == u3h(yil)) + { + // any unconstrained nock computation is a potential urwasm reentry: + // save the pointers before that, restore after + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + monad_cont = uw_slam_check( + u3k(cont), + u3k(u3t(yil)), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(yil); + yil = u3_none; + } + } + + u3z(monad); + if (u3_none == yil) + { + return _reduce_monad(monad_cont, sat_u); + } + else + { + return yil; + } + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->catch_bat)) + { + // catch + u3_noun monad_try = u3at(120, monad); + u3_noun monad_catch = u3at(121, monad); + u3_noun cont = u3at(61, monad); + u3_weak yil; + u3_noun monad_cont; + + { + { // push on suspend stacks + m3_SuspendStackPush64(sat_u->wasm_module->runtime, west_catch_try); + m3_SuspendStackPushExtTag(sat_u->wasm_module->runtime); + _push_list( + u3nt(lst_catch_try, u3k(monad_catch), u3k(cont)), + &sat_u->susp_list + ); + } + yil = _reduce_monad(u3k(monad_try), sat_u); + + if (1 != u3h(yil)) + { // pop suspend stacks + m3_SuspendStackPopExtTag(sat_u->wasm_module->runtime); + c3_d tag; + m3_SuspendStackPop64(sat_u->wasm_module->runtime, &tag); + if (tag != -1 && tag != west_catch_try) + { + printf(ERR("catch-try tag mismatch: %"PRIc3_d), tag); + return u3m_bail(c3__fail); + } + u3_noun frame = _pop_list(&sat_u->susp_list); + if (u3_none != frame && lst_catch_try != u3h(frame)) + { + printf(ERR("wrong frame: catch-try")); + return u3m_bail(c3__fail); + } + u3z(frame); + } + + if (0 == u3h(yil)) + { + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + monad_cont = uw_slam_check( + u3k(cont), + u3k(u3t(yil)), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(yil); + yil = u3_none; + } + else if (2 == u3h(yil)) + { + u3z(yil); + + { // push on suspend stacks + m3_SuspendStackPush64(sat_u->wasm_module->runtime, west_catch_err); + m3_SuspendStackPushExtTag(sat_u->wasm_module->runtime); + _push_list( + u3nc(lst_catch_err, u3k(cont)), + &sat_u->susp_list + ); + } + + yil = _reduce_monad(u3k(monad_catch), sat_u); + + if (1 != u3h(yil)) + { // pop suspend stacks + m3_SuspendStackPopExtTag(sat_u->wasm_module->runtime); + c3_d tag; + m3_SuspendStackPop64(sat_u->wasm_module->runtime, &tag); + if (tag != -1 && tag != west_catch_err) + { + printf(ERR("catch-err tag mismatch: %"PRIc3_d), tag); + return u3m_bail(c3__fail); + } + u3_noun frame = _pop_list(&sat_u->susp_list); + if (u3_none != frame && lst_catch_err != u3h(frame)) + { + printf(ERR("wrong frame: catch-err")); + return u3m_bail(c3__fail); + } + u3z(frame); + } + + if (0 == u3h(yil)) + { + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + monad_cont = uw_slam_check( + u3k(cont), + u3k(u3t(yil)), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(yil); + yil = u3_none; + } + } + } + + u3z(monad); + if (u3_none == yil) + { + return _reduce_monad(monad_cont, sat_u); + } + else + { + return yil; + } + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->return_bat)) + { + // return + u3_noun yil = u3nc(0, u3k(u3at(30, monad))); + u3z(monad); + return yil; + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->global_set_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->global_set_ctx)) + { + return u3m_bail(c3__fail); + } + // global-set + u3_atom name = u3x_atom(u3at(arr_sam_2, monad)); + u3_atom value = u3x_atom(u3at(arr_sam_3, monad)); + + c3_w met_w = u3r_met(3, name); + c3_c* name_c = u3a_malloc(met_w + 1); + u3r_bytes(0, met_w, (c3_y*)name_c, name); + name_c[met_w] = 0; + + IM3Global glob = m3_FindGlobal(sat_u->wasm_module, name_c); + + if (!glob) + { + fprintf(stderr, ERR("global %s not found"), name_c); + return u3m_bail(c3__fail); + } + + if (!glob->isMutable) + { + fprintf(stderr, ERR("global %s not mutable"), name_c); + return u3m_bail(c3__fail); + } + + M3TaggedValue glob_value; + M3Result result = m3_GetGlobal(glob, &glob_value); + if (result) + { + fprintf(stderr, ERR("couldn't get global %s: %s"), name_c, result); + return u3m_bail(c3__fail); + } + switch (glob_value.type) + { + default: + { + return u3m_bail(c3__fail); + } + case c_m3Type_i32: + { + glob_value.value.i32 = u3r_word(0, value); + break; + } + case c_m3Type_i64: + { + glob_value.value.i64 = u3r_chub(0, value); + break; + } + case c_m3Type_f32: + { + glob_value.value.f32 = u3r_word(0, value); + break; + } + case c_m3Type_f64: + { + glob_value.value.f64 = u3r_chub(0, value); + break; + } + } + result = m3_SetGlobal(glob, &glob_value); + if (result) + { + fprintf(stderr, ERR("couldn't set global %s: %s"), name_c, result); + return u3m_bail(c3__fail); + } + u3z(monad); + u3a_free(name_c); + return u3nc(0, 0); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->global_get_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->global_get_ctx)) + { + return u3m_bail(c3__fail); + } + // global-get + u3_atom name = u3x_atom(u3at(arr_sam, monad)); + + c3_w met_w = u3r_met(3, name); + c3_c* name_c = u3a_malloc(met_w + 1); + u3r_bytes(0, met_w, (c3_y*)name_c, name); + name_c[met_w] = 0; + + IM3Global glob = m3_FindGlobal(sat_u->wasm_module, name_c); + if (!glob) + { + fprintf(stderr, ERR("global %s not found"), name_c); + return u3m_bail(c3__fail); + } + + M3TaggedValue glob_value; + M3Result result = m3_GetGlobal(glob, &glob_value); + if (result) + { + fprintf(stderr, ERR("couldn't get global %s: %s"), name_c, result); + return u3m_bail(c3__fail); + } + + u3_noun out; + switch (glob_value.type) + { + default: + { + return u3m_bail(c3__fail); + } + case c_m3Type_i32: + { + out = u3i_word(glob_value.value.i32); + break; + } + case c_m3Type_i64: + { + out = u3i_chub(glob_value.value.i64); + break; + } + case c_m3Type_f32: + { + out = u3i_word(glob_value.value.f32); + break; + } + case c_m3Type_f64: + { + out = u3i_chub(glob_value.value.f64); + break; + } + } + + u3z(monad); + u3a_free(name_c); + return u3nc(0, out); + + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->mem_size_bat)) + { + if (c3n == u3r_sing(u3at(MONAD_CTX, monad), sat_u->match->mem_size_ctx)) + { + return u3m_bail(c3__fail); + } + // memory-size + if (!sat_u->wasm_module->memoryInfo.hasMemory) + { + fprintf(stderr, ERR("memsize no memory")); + return u3m_bail(c3__fail); + } + c3_w num_pages = sat_u->wasm_module->runtime->memory.numPages; + + u3z(monad); + return u3nc(0, u3i_word(num_pages)); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->mem_grow_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->mem_grow_ctx)) + { + return u3m_bail(c3__fail); + } + // memory-grow + if (!sat_u->wasm_module->memoryInfo.hasMemory) + { + fprintf(stderr, ERR("memgrow no memory")); + return u3m_bail(c3__fail); + } + + u3_noun delta = u3at(arr_sam, monad); + + c3_l delta_l = (c3y == u3a_is_cat(delta)) ? delta : u3m_bail(c3__fail); + + c3_w n_pages = sat_u->wasm_module->runtime->memory.numPages; + c3_w required_pages = n_pages + delta_l; + + M3Result result = ResizeMemory(sat_u->wasm_module->runtime, required_pages); + + if (result) + { + fprintf(stderr, ERR("failed to resize memory: %s"), result); + return u3m_bail(c3__fail); + } + + u3z(monad); + return u3nc(0, u3i_word(n_pages)); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->get_acc_bat)) + { + u3z(monad); + return u3nc(0, u3k(sat_u->acc)); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->set_acc_bat)) + { + u3_noun new = u3k(u3at(arr_sam, monad)); + u3z(monad); + u3z(sat_u->acc); + sat_u->acc = new; + return u3nc(0, 0); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->get_all_glob_bat)) + { + if (c3n == u3r_sing(u3at(MONAD_CTX, monad), sat_u->match->get_all_glob_ctx)) + { + return u3m_bail(c3__fail); + } + u3z(monad); + u3_noun atoms = u3_nul; + c3_w n_globals = sat_u->wasm_module->numGlobals; + c3_w n_globals_import = sat_u->wasm_module->numGlobImports; + while (n_globals-- > n_globals_import) + { + M3Global glob = sat_u->wasm_module->globals[n_globals]; + switch (glob.type) + { + default: + { + return u3m_bail(c3__fail); + } + case c_m3Type_i32: + { + atoms = u3nc(u3i_word(glob.intValue), atoms); + break; + } + case c_m3Type_i64: + { + atoms = u3nc(u3i_chub(glob.intValue), atoms); + break; + } + case c_m3Type_f32: + { + atoms = u3nc(u3i_word(glob.f32Value), atoms); + break; + } + case c_m3Type_f64: + { + atoms = u3nc(u3i_chub(glob.f64Value), atoms); + break; + } + } + } + return u3nc(0, atoms); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->set_all_glob_bat)) + { + if (c3n == u3r_sing(u3at(ARROW_CTX, monad), sat_u->match->set_all_glob_ctx)) + { + return u3m_bail(c3__fail); + } + u3_noun atoms = u3at(arr_sam, monad); + c3_w n_globals = sat_u->wasm_module->numGlobals; + c3_w n_globals_import = sat_u->wasm_module->numGlobImports; + for (c3_w i = n_globals_import; i < n_globals; i++) + { + IM3Global glob = &sat_u->wasm_module->globals[i]; + u3_noun atom; + u3x_cell(atoms, &atom, &atoms); + u3x_atom(atom); + switch (glob->type) + { + default: + { + return u3m_bail(c3__fail); + } + case c_m3Type_i32: + { + glob->intValue = u3r_word(0, atom); + break; + } + case c_m3Type_i64: + { + glob->intValue = u3r_chub(0, atom); + break; + } + case c_m3Type_f32: + { + glob->f32Value = u3r_word(0, atom); + break; + } + case c_m3Type_f64: + { + glob->f64Value = u3r_chub(0, atom); + break; + } + } + } + if (u3_nul != atoms) + { + fprintf(stderr, WUT("glob list too long")); + return u3m_bail(c3__exit); + } + u3z(monad); + return u3nc(0, 0); + } + else if (c3y == u3r_sing(monad_bat, sat_u->match->fail_bat)) + { + u3z(monad); + return u3nc(2, 0); + } + else + { + return u3m_bail(c3__fail); + } +} + +static const M3Result +_resume_callback(M3Result result_m3, IM3Runtime runtime) +{ + if (result_m3 == m3Err_ComputationBlock + || result_m3 == m3Err_SuspensionError) + { + return result_m3; + } + M3Result result = m3Err_none; + lia_state* sat_u = runtime->userdata_resume; + m3_SuspendStackPopExtTag(runtime); + c3_d tag_d; + m3_SuspendStackPop64(runtime, &tag_d); + switch (tag_d) + { + default: + { + u3m_bail(c3__fail); + } + case west_call: + { + c3_d f_idx_d; + m3_SuspendStackPop64(sat_u->wasm_module->runtime, &f_idx_d); + u3_noun frame = _pop_list(&sat_u->susp_list); + if (lst_call != u3h(frame)) + { + printf(ERR("wrong frame: call")); + u3m_bail(c3__fail); + } + u3_noun name = u3t(frame); + c3_w met_w = u3r_met(3, name); + c3_c* name_c = u3a_malloc(met_w + 1); + u3r_bytes(0, met_w, (c3_y*)name_c, name); + u3z(frame); + name_c[met_w] = 0; + + u3_noun yil; + if (_deterministic_trap(result_m3)) + { + fprintf(stderr, WUT("%s call trapped: %s"), name_c, result_m3); + yil = u3nc(2, 0); + } + else if (result_m3) + { + fprintf(stderr, ERR("%s call failed: %s"), name_c, result_m3); + u3m_bail(c3__fail); + } + else + { + IM3Function f = runtime->modules->functions + f_idx_d; + c3_w n_out_w = f->funcType->numRets; + c3_d *vals_out = u3a_calloc(n_out_w, sizeof(c3_d)); + void **valptrs_out = u3a_calloc(n_out_w, sizeof(void*)); + for (c3_w i = 0; i < n_out_w; i++) + { + valptrs_out[i] = &vals_out[i]; + } + M3Result result_tmp = m3_GetResults(f, + n_out_w, + (const void**)valptrs_out + ); + if (result_tmp) + { + fprintf(stderr, + ERR("function %s failed to get results: %s"), name_c, result_tmp + ); + u3m_bail(c3__fail); + } + yil = u3nc(0, + _atoms_from_stack(valptrs_out, n_out_w, f->funcType->types) + ); + u3a_free(valptrs_out); + u3a_free(vals_out); + } + if (u3_none != sat_u->resolution) + { + u3m_bail(c3__fail); + } + sat_u->resolution = yil; + u3a_free(name_c); + break; + } + + case west_call_ext: + { + if (1 == u3h(sat_u->resolution)) + { + // it's a new block, it's not yet resolved + // restore the frame + // + m3_SuspendStackPush64(runtime, tag_d); + m3_SuspendStackPushExtTag(runtime); + result = m3Err_ComputationBlock; + } + // else the block is resolved and sat_u->resolution holds the result + // + break; + } + + case west_try: + { + if (1 != u3h(sat_u->resolution)) + { + u3_noun frame = _pop_list(&sat_u->susp_list); + if (lst_try != u3h(frame)) + { + printf(ERR("wrong frame: try")); + u3m_bail(c3__fail); + } + if (0 == u3h(sat_u->resolution)) + { + u3_noun cont = u3t(frame); + u3_noun p_res = u3t(sat_u->resolution); + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + u3_noun monad_cont = uw_slam_check( + u3k(cont), + u3k(p_res), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(sat_u->resolution); + sat_u->resolution = _reduce_monad(monad_cont, sat_u); + } + // if %2 then nothing to do, sat_u->resolution already holds %2 result + // + u3z(frame); + } + else + { + // we shouldn't be here + // + u3m_bail(c3__fail); + } + break; + } + + case west_catch_try: + { + if (1 != u3h(sat_u->resolution)) + { + u3_noun frame = _pop_list(&sat_u->susp_list); + if (lst_catch_try != u3h(frame)) + { + printf(ERR("wrong frame: catch-try")); + u3m_bail(c3__fail); + } + if (0 == u3h(sat_u->resolution)) + { + u3_noun cont = u3t(u3t(frame)); + u3_noun p_res = u3t(sat_u->resolution); + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + u3_noun monad_cont = uw_slam_check( + u3k(cont), + u3k(p_res), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(sat_u->resolution); + sat_u->resolution = _reduce_monad(monad_cont, sat_u); + } + // %2 + // + else + { + u3_noun cont = u3t(u3t(frame)); + u3_noun monad_catch = u3h(u3t(frame)); + { // push on suspend stacks + m3_SuspendStackPush64(sat_u->wasm_module->runtime, west_catch_err); + m3_SuspendStackPushExtTag(runtime); + _push_list( + u3nc(lst_catch_err, u3k(cont)), + &sat_u->susp_list + ); + } + + u3_noun yil = _reduce_monad(u3k(monad_catch), sat_u); + + if (1 != u3h(yil)) + { // pop suspend stacks + m3_SuspendStackPopExtTag(runtime); + c3_d tag; + m3_SuspendStackPop64(sat_u->wasm_module->runtime, &tag); + if (tag != -1 && tag != west_catch_err) + { + printf(ERR("catch-err tag mismatch: %"PRIc3_d), tag); + u3m_bail(c3__fail); + } + u3_noun frame1 = _pop_list(&sat_u->susp_list); + if (lst_catch_err != u3h(frame1)) + { + printf(ERR("wrong frame: catch-err")); + u3m_bail(c3__fail); + } + u3z(frame1); + } + + if (2 == u3h(yil)) + { + // sat_u->resolution already has %2, do nothing + u3z(yil); + } + else if (1 == u3h(yil)) + { + u3z(sat_u->resolution); + sat_u->resolution = yil; + } + else // %0 + { + u3_noun p_res = u3t(yil); + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + u3_noun monad_cont = uw_slam_check( + u3k(cont), + u3k(p_res), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(sat_u->resolution); + u3z(yil); + sat_u->resolution = _reduce_monad(monad_cont, sat_u); + } + } + u3z(frame); + } + else + { + // we shouldn't be here + // + u3m_bail(c3__fail); + } + break; + } + case west_catch_err: + { + if (1 != u3h(sat_u->resolution)) + { + u3_noun frame = _pop_list(&sat_u->susp_list); + if (lst_catch_err != u3h(frame)) + { + printf(ERR("wrong frame: catch-err")); + u3m_bail(c3__fail); + } + if (0 == u3h(sat_u->resolution)) + { + u3_noun cont = u3t(frame); + u3_noun p_res = u3t(sat_u->resolution); + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + u3_noun monad_cont = uw_slam_check( + u3k(cont), + u3k(p_res), + sat_u->is_stateful + ); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3z(sat_u->resolution); + sat_u->resolution = _reduce_monad(monad_cont, sat_u); + } + // if %2 then nothing to do, sat_u->resolution already holds %2 result + // + u3z(frame); + } + else + { + // we shouldn't be here + // + u3m_bail(c3__fail); + } + break; + } + case west_link_wasm: + { + if (1 != u3h(sat_u->resolution)) + { + c3_d _sp_offset_d, func_idx_d; + m3_SuspendStackPop64(runtime, &func_idx_d); + m3_SuspendStackPop64(runtime, &_sp_offset_d); + if (2 == u3h(sat_u->resolution)) + { + u3z(sat_u->resolution); + sat_u->resolution = u3_none; + result = UrwasmArrowExit; + } + else // %0 + { + IM3Function f = runtime->modules->functions + func_idx_d; + uint64_t * _sp = (uint64_t *)(runtime->base + _sp_offset_d); + c3_w n_out = f->funcType->numRets; + c3_y* types = f->funcType->types; + void **valptrs_out = u3a_calloc(n_out, sizeof(void*)); + const char *mod = f->import.moduleUtf8; + const char *name = f->import.fieldUtf8; + for (c3_w i = 0; i < n_out; i++) + { + valptrs_out[i] = &_sp[i]; + } + c3_o pushed = _coins_to_stack( + u3t(sat_u->resolution), + valptrs_out, + n_out, + types + ); + + if (c3n == pushed) + { + printf(ERR("import result type mismatch: %s/%s"), mod, name); + result = "import result type mismatch"; + } + + u3z(sat_u->resolution); + sat_u->resolution = u3_none; + u3a_free(valptrs_out); + } + } + else + { + // we shouldn't be here + // + u3m_bail(c3__fail); + } + break; + } + } + + return result; +} + +// TRANSFERS sat->arrow_yil if m3Err_ComputationBlock is thrown +static const void * +_link_wasm_with_arrow_map( + IM3Runtime runtime, + IM3ImportContext _ctx, + uint64_t * _sp, + void * _mem +) +{ + const char *mod = _ctx->function->import.moduleUtf8; + const char *name = _ctx->function->import.fieldUtf8; + lia_state* sat_u = _ctx->userdata; + + u3_noun key = u3nc(u3i_string(mod), u3i_string(name)); + u3_weak arrow = u3kdb_get(u3k(sat_u->map), key); + if (u3_none == arrow) + { + fprintf(stderr, ERR("import not found: %s/%s"), mod, name); + return m3Err_functionImportMissing; + } + c3_w n_in = _ctx->function->funcType->numArgs; + c3_w n_out = _ctx->function->funcType->numRets; + c3_y* types = _ctx->function->funcType->types; + void **valptrs_in = u3a_calloc(n_in, sizeof(void*)); + for (c3_w i = 0; i < n_in; i++) + { + valptrs_in[i] = &_sp[i+n_out]; + } + void **valptrs_out = u3a_calloc(n_out, sizeof(void*)); + for (c3_w i = 0; i < n_out; i++) + { + valptrs_out[i] = &_sp[i]; + } + + u3_noun coin_wasm_list = _coins_from_stack(valptrs_in, n_in, (types+n_out)); + + { // push on suspend stacks + m3_SuspendStackPush64(runtime, (c3_d)((c3_y*)_sp - (c3_y*)runtime->base)); + c3_d func_idx_d = _ctx->function - runtime->modules->functions; + m3_SuspendStackPush64(runtime, func_idx_d); + m3_SuspendStackPush64(runtime, west_link_wasm); + m3_SuspendStackPushExtTag(runtime); + } + + uw_arena* box_arena_frame = BoxArena; + uw_arena* code_arena_frame = CodeArena; + u3_noun script = uw_slam_check(arrow, coin_wasm_list, sat_u->is_stateful); + BoxArena = box_arena_frame; + CodeArena = code_arena_frame; + u3_noun yil = _reduce_monad(script, sat_u); + + M3Result result = m3Err_none; + + if (1 != u3h(yil)) + { // pop suspend stacks + m3_SuspendStackPopExtTag(runtime); + c3_d tag; + m3_SuspendStackPop64(runtime, &tag); + if (tag != -1 && tag != west_link_wasm) + { + printf(ERR("west_link tag mismatch: %"PRIc3_d), tag); + u3m_bail(c3__fail); + } + m3_SuspendStackPop64(runtime, NULL); + m3_SuspendStackPop64(runtime, NULL); + + } + + if (1 == u3h(yil)) + { + if (sat_u->arrow_yil != u3_none) + { + u3z(yil); + result = "non-empty sat_u->arrow_yil on block"; + } + else + { + sat_u->arrow_yil = yil; + result = m3Err_ComputationBlock; // start suspending if not yet suspending + } + } + else if (2 == u3h(yil)) + { + u3z(yil); + result = UrwasmArrowExit; + } + else + { + c3_o pushed = _coins_to_stack(u3t(yil), valptrs_out, n_out, types); + u3z(yil); + if (c3n == pushed) + { + fprintf(stderr, ERR("import result type mismatch: %s/%s"), mod, name); + result = "import result type mismatch"; + } + } + u3a_free(valptrs_in); + u3a_free(valptrs_out); + return result; +} + +// key: [uw_run_m seed] +// stored nouns: +// $@ ~ :: tombstone value +// $: yield=* :: +2 +// queue=(list script) :: +6 +// box_arena=[buffer=octs padding=@] :: [[+56 +57] +29] +// memory=[buffer=octs max_stack_offset=@] :: [[+120 +121] +61] +// runtime_offset=@ :: +62 +// lia_shop=(list) :: +126 +// acc=* :: +254 +// susp_list=(list) :: +255 +// == +// arguments RETAINED +// on success allocates sat_u->wasm_module->runtime->memory.mallocated +// and initializes the arenas +static c3_t +_get_state(u3_noun hint, u3_noun seed, lia_state* sat_u) +{ + // u3_weak get = u3z_find_m(u3z_memo_keep, uw_run_m, seed); + // XX order of search matters (sentinel value ~ + // from previous invocation is closer to the home road) + // and u3z_find_m searches from home road down, which is the opposite + // of what we want + // + u3_noun key = u3z_key(uw_run_m, seed); + u3_weak get = u3z_find_up(key); + u3z(key); + + if (u3_none == get || u3_nul == get) + { + return 0; + } + else + { + u3_noun yil_previous; + u3_noun queue; + u3_noun p_box_buffer, q_box_buffer, pad_box; + u3_noun p_mem_buffer, q_mem_buffer, stack_offset; + u3_noun runtime_offset; + u3_noun lia_shop; + u3_noun acc; + u3_noun susp_list; + + if ( c3n == u3r_mean(get, + 2, &yil_previous, + 6, &queue, + 56, &p_box_buffer, + 57, &q_box_buffer, + 29, &pad_box, + 120, &p_mem_buffer, + 121, &q_mem_buffer, + 61, &stack_offset, + 62, &runtime_offset, + 126, &lia_shop, + 254, &acc, + 255, &susp_list, + 0) + ) + { + return u3m_bail(c3__fail); + } + c3_w box_len_w = (c3y == u3a_is_cat(p_box_buffer)) + ? p_box_buffer + : u3m_bail(c3__fail); + + c3_w pad_w = (c3y == u3a_is_cat(pad_box)) + ? pad_box + : u3m_bail(c3__fail); + + c3_w run_off_w = (c3y == u3a_is_cat(runtime_offset)) + ? runtime_offset + : u3m_bail(c3__fail); + + c3_w len_buf_w = (c3y == u3a_is_cat(p_mem_buffer)) + ? p_mem_buffer + : u3m_bail(c3__fail); + + c3_w stk_off_w = (c3y == u3a_is_cat(stack_offset)) + ? stack_offset + : u3m_bail(c3__fail); + + _uw_arena_init_size(BoxArena, box_len_w); + u3r_bytes(pad_w, box_len_w, BoxArena->buf_y, q_box_buffer); + _uw_arena_init(CodeArena); + + M3Result result; + IM3Runtime wasm3_runtime = (IM3Runtime)(BoxArena->buf_y + run_off_w); + wasm3_runtime->base = BoxArena->buf_y; + wasm3_runtime->base_transient = CodeArena->buf_y; + m3_RewritePointersRuntime(wasm3_runtime, BoxArena->buf_y, 0 /*is_store*/); + IM3Module wasm3_module = wasm3_runtime->modules; + c3_w n_imports = wasm3_module->numFuncImports; + + // make sure to not touch BoxArena + m3_SetAllocators(_calloc_bail, _free_bail, _realloc_bail); + m3_SetTransientAllocators(_calloc_code, _free_code, _realloc_code); + m3_SetMemoryAllocators(_calloc_bail, _free_bail, _realloc_bail); + + jmp_buf esc; + CodeArena->esc_u = &esc; + c3_i jmp_i; + + while (1) + { + wasm3_runtime->base_transient = CodeArena->buf_y; + + if (0 == (jmp_i = setjmp(esc))) + { + for (c3_w i = 0; i < n_imports; i++) + { + M3Function f = wasm3_module->functions[i]; + const char* mod = f.import.moduleUtf8; + const char* name = f.import.fieldUtf8; + + result = m3_LinkRawFunctionEx( + wasm3_module, mod, name, + NULL, &_link_wasm_with_arrow_map, + sat_u + ); + + if (result) + { + fprintf(stderr, ERR("link error: %s"), result); + return u3m_bail(c3__fail); + } + } + + result = m3_CompileModule(wasm3_module); + if (result) + { + fprintf(stderr, ERR("compilation error: %s"), result); + return u3m_bail(c3__fail); + } + + break; + } + else + { + if (jmp_i == c3__code) + { + _uw_arena_grow(CodeArena); + } + else + { + return u3m_bail(c3__fail); + } + continue; + } + } + + { + sat_u->yil_previous = u3k(yil_previous); + sat_u->queue = u3k(queue); + sat_u->wasm_module = wasm3_module; + sat_u->lia_shop = u3k(lia_shop); + sat_u->acc = u3k(acc); + // sat_u->map to be filled afterwards + // sat_u->match same + // sat_u->resolution same + sat_u->arrow_yil = u3_none; + sat_u->susp_list = u3k(susp_list); + M3MemoryHeader* mem = u3a_malloc(len_buf_w + sizeof(M3MemoryHeader)); + mem->runtime = wasm3_runtime; + mem->maxStack = BoxArena->buf_y + stk_off_w; + mem->length = len_buf_w; + u3r_bytes(0, len_buf_w, (u8*)(mem + 1), q_mem_buffer); + wasm3_runtime->memory.mallocated = mem; + } + + u3z(get); + + return 1; + } +} + +// arguments RETAINED, returned yield transfered. +// transfers sat_u->yil_previous if it is returned, and replaces +// the struct value with u3_none +static u3_noun +_apply_diff(u3_noun input_tag, u3_noun p_input, lia_state* sat_u) +{ + m3_SetAllocators(_calloc_bail, _free_bail, _realloc_bail); + m3_SetTransientAllocators(_calloc_bail, _free_bail, _realloc_bail); + m3_SetMemoryAllocators(u3a_calloc, u3a_free, u3a_realloc); + + if (input_tag == c3y) + { + if (sat_u->wasm_module->runtime->edge_suspend) + { + // appended new script but the computation is still suspended: + // add script to queue, return previous yield + if (sat_u->yil_previous == u3_none) + { + return u3m_bail(c3__fail); + } + sat_u->queue = u3kb_weld(sat_u->queue, u3nc(u3k(p_input), u3_nul)); // snoc + u3_noun yil = sat_u->yil_previous; + sat_u->yil_previous = u3_none; + return yil; + } + else + { + return _reduce_monad(u3k(p_input), sat_u); + } + } + else + { + if (!sat_u->wasm_module->runtime->edge_suspend) + { + // appended external call resolution but no block to resolve: + // snoc result to shop, return previous yield + if (sat_u->yil_previous == u3_none) + { + return u3m_bail(c3__fail); + } + sat_u->lia_shop = u3kb_weld(sat_u->lia_shop, u3nc(u3k(p_input), u3_nul)); // snoc + u3_noun yil = sat_u->yil_previous; + sat_u->yil_previous = u3_none; + return yil; + } + // else resume + IM3Runtime run_u = sat_u->wasm_module->runtime; + run_u->resume_external = _resume_callback; + run_u->userdata_resume = sat_u; + if (sat_u->resolution != u3_none) + { + return u3m_bail(c3__fail); + } + sat_u->resolution = u3nc(0, u3k(p_input)); + M3Result result = m3_Resume(run_u); + u3_noun yil; + if (result == m3Err_ComputationBlock) + { + yil = sat_u->resolution; + sat_u->resolution = u3_none; + if (yil == u3_none) + { + yil = sat_u->arrow_yil; + sat_u->arrow_yil = u3_none; + if (yil == u3_none) + { + return u3m_bail(c3__fail); + } + } + } + else if (_deterministic_trap(result)) + { + fprintf(stderr, WUT("function call trapped: %s"), result); // XX get name of entry function? + yil = u3nc(2, 0); + } + else if (result == m3Err_functionImportMissing) + { + return u3m_bail(c3__exit); + } + else if (result) + { + fprintf(stderr, ERR("resumption failed: %s"), result); + return u3m_bail(c3__fail); + } + else + { + yil = sat_u->resolution; + sat_u->resolution = u3_none; + if (yil == u3_none) + { + return u3m_bail(c3__fail); + } + + if (sat_u->queue != u3_none) + { + while (u3h(yil) == 0 && sat_u->queue != u3_nul) + { + u3z(yil); + u3_noun deferred_script = _pop_list(&sat_u->queue); + yil = _reduce_monad(deferred_script, sat_u); + } + } + } + + return yil; + } +} + +// try to save new state, replacing old state with a tombstone value +// frees wasm3 memory buffer, releases arenas +// RETAINS arguments, transfers sat_u->lia_shop/susp_list/queue and +// replaces them with u3_none if save is succesful +static void +_move_state( + lia_state* sat_u, + u3_noun seed_old, + u3_noun seed_new, + u3_noun hint, + u3_noun yil) +{ + if ( (c3__oust == hint) + || (2 == u3h(yil)) + || (c3__rand == hint && 0 == u3h(yil)) + ) + { + u3z_save_m(u3z_memo_keep, uw_run_m, seed_old, u3_nul); + IM3Runtime run_u = sat_u->wasm_module->runtime; + M3MemoryHeader* mem_u = run_u->memory.mallocated; + u3a_free(mem_u); + _uw_arena_free(CodeArena); + _uw_arena_free(BoxArena); + return; + } + + IM3Runtime run_u = sat_u->wasm_module->runtime; + M3MemoryHeader* mem_u = run_u->memory.mallocated; + c3_w stk_off_w = (u8*)mem_u->maxStack - BoxArena->buf_y; + if (c3n == u3a_is_cat(stk_off_w)) + { + u3m_bail(c3__fail); + } + + c3_w len_buf_w = mem_u->length; + if (c3n == u3a_is_cat(len_buf_w)) + { + u3m_bail(c3__fail); + } + + u3_atom q_buf = u3i_bytes(len_buf_w, (c3_y*)(mem_u + 1)); + + u3a_free(mem_u); + + m3_RewritePointersRuntime(run_u, BoxArena->buf_y, 1 /*is_store*/); + c3_w run_off_w = (c3_y*)run_u - BoxArena->buf_y; + if (c3n == u3a_is_cat(run_off_w)) + { + u3m_bail(c3__fail); + } + + _uw_arena_free(CodeArena); + + c3_w box_len_w = BoxArena->siz_w; + if (c3n == u3a_is_cat(box_len_w)) + { + u3m_bail(c3__fail); + } + + c3_y pad_y = BoxArena->pad_y; + + u3_atom q_box = u3i_slab_mint(&BoxArena->sab_u); + BoxArena->ini_t = 0; + + u3_noun stash = uw_octo( + u3k(yil), + sat_u->queue, + u3nc(u3nc(box_len_w, q_box), pad_y), + u3nc(u3nc(len_buf_w, q_buf), stk_off_w), + run_off_w, + sat_u->lia_shop, + u3k(sat_u->acc), // accumulator will be returned + sat_u->susp_list + ); + sat_u->lia_shop = u3_none; + sat_u->susp_list = u3_none; + sat_u->queue = u3_none; + + u3z_save_m(u3z_memo_keep, uw_run_m, seed_old, u3_nul); + + u3z_save_m(u3z_memo_keep, uw_run_m, seed_new, stash); + + u3z(stash); +} + +u3_weak +u3we_lia_run_v1(u3_noun cor) +{ +#ifndef URWASM_STATEFUL + return u3_none; +#else + + u3_noun hint = u3at(u3x_sam_7, cor); + if (c3__none == hint) + { + return u3_none; + } + + // strand: save %1, delete in other cases + c3_t rand_t = (c3__rand == hint); + + // agent: always save + c3_t gent_t = (c3__gent == hint); + + // oust: don't save + c3_t oust_t = (c3__oust == hint); + + // omit: run statelessly + c3_t omit_t = !(rand_t || gent_t || oust_t); + + #ifdef URWASM_SUBROAD + + // enter subroad, 4MB safety buffer + u3m_hate(1 << 20); + + #endif + + u3_noun ctx = u3at(RUN_CTX, cor); + u3r_mug(ctx); + + u3_noun input = u3at(u3x_sam_2, cor); + u3_noun seed = u3at(u3x_sam_6, cor); + + u3_noun runnable = uw_kick_nock(u3k(ctx), AX_RUNNABLE); + u3_noun arrows = KICK1(uw_kick_nock(u3k(ctx), AX_ARROWS)); + + u3_noun try_gate = uw_kick_nock(u3k(runnable), AX_TRY); + u3_noun try_gate_inner = KICK1(try_gate); + + u3_noun seed_new; + u3_noun input_tag, p_input; + u3x_cell(input, &input_tag, &p_input); + + if (input_tag == c3y) + { + u3_noun p_input_gate = u3nt(u3nc(0, 7), 0, u3k(p_input)); // =>(p.input |=(* +>)) + u3_noun past_new = uw_slam_nock( + u3k(try_gate_inner), + u3nc( + u3k(u3at(seed_past, seed)), + p_input_gate + ) + ); + seed_new = u3nq( + u3k(u3at(seed_module, seed)), + past_new, + u3k(u3at(seed_shop, seed)), + u3k(u3at(seed_import, seed)) + ); + } + else if (input_tag == c3n) + { + seed_new = u3nq( + u3k(u3at(seed_module, seed)), + u3k(u3at(seed_past, seed)), + u3nc(u3k(p_input), u3k(u3at(seed_shop, seed))), + u3k(u3at(seed_import, seed)) + ); + } + else + { + return u3m_bail(c3__fail); + } + + u3_noun call_script = KICK1(uw_kick_nock(u3k(arrows), AX_CALL)); + u3_noun memread_script = KICK1(uw_kick_nock(u3k(arrows), AX_MEMREAD)); + u3_noun memwrite_script = KICK1(uw_kick_nock(u3k(arrows), AX_MEMWRITE)); + u3_noun call_ext_script = KICK1(uw_kick_nock(u3k(arrows), AX_CALL_EXT)); + u3_noun global_set_script = KICK1(uw_kick_nock(u3k(arrows), AX_GLOBAL_SET)); + u3_noun global_get_script = KICK1(uw_kick_nock(u3k(arrows), AX_GLOBAL_GET)); + u3_noun mem_grow_script = KICK1(uw_kick_nock(u3k(arrows), AX_MEM_GROW)); + u3_noun mem_size_script = uw_kick_nock(u3k(arrows), AX_MEM_SIZE); + u3_noun get_acc_script = uw_kick_nock(u3k(arrows), AX_GET_ACC); + u3_noun set_acc_script = KICK1(uw_kick_nock(u3k(arrows), AX_SET_ACC)); + u3_noun get_all_glob_script = uw_kick_nock(u3k(arrows), AX_GET_ALL_GLOB); + u3_noun set_all_glob_script = KICK1(uw_kick_nock( arrows, AX_SET_ALL_GLOB)); + + u3_noun try_script = KICK1(try_gate_inner); + u3_noun catch_script = KICK2(uw_kick_nock(u3k(runnable), AX_CATCH)); + u3_noun return_script = KICK1(uw_kick_nock(u3k(runnable), AX_RETURN)); + u3_noun fail_script = uw_kick_nock( runnable, AX_FAIL); + + u3_noun call_bat = u3k(u3h(call_script)); + u3_noun memread_bat = u3k(u3h(memread_script)); + u3_noun memwrite_bat = u3k(u3h(memwrite_script)); + u3_noun call_ext_bat = u3k(u3h(call_ext_script)); + u3_noun try_bat = u3k(u3h(try_script)); + u3_noun catch_bat = u3k(u3h(catch_script)); + u3_noun return_bat = u3k(u3h(return_script)); + u3_noun fail_bat = u3k(u3h(fail_script)); + u3_noun global_set_bat = u3k(u3h(global_set_script)); + u3_noun global_get_bat = u3k(u3h(global_get_script)); + u3_noun mem_grow_bat = u3k(u3h(mem_grow_script)); + u3_noun mem_size_bat = u3k(u3h(mem_size_script)); + u3_noun get_acc_bat = u3k(u3h(get_acc_script)); + u3_noun set_acc_bat = u3k(u3h(set_acc_script)); + u3_noun get_all_glob_bat = u3k(u3h(get_all_glob_script)); + u3_noun set_all_glob_bat = u3k(u3h(set_all_glob_script)); + + u3_noun call_ctx = u3k(u3at(ARROW_CTX, call_script)); + u3_noun memread_ctx = u3k(u3at(ARROW_CTX, memread_script)); + u3_noun memwrite_ctx = u3k(u3at(ARROW_CTX, memwrite_script)); + u3_noun global_set_ctx = u3k(u3at(ARROW_CTX, global_set_script)); + u3_noun global_get_ctx = u3k(u3at(ARROW_CTX, global_get_script)); + u3_noun mem_grow_ctx = u3k(u3at(ARROW_CTX, mem_grow_script)); + u3_noun mem_size_ctx = u3k(u3at(MONAD_CTX, mem_size_script)); + u3_noun get_all_glob_ctx = u3k(u3at(MONAD_CTX, get_all_glob_script)); + u3_noun set_all_glob_ctx = u3k(u3at(ARROW_CTX, set_all_glob_script)); + + u3z(call_script); + u3z(memread_script); + u3z(memwrite_script); + u3z(call_ext_script); + u3z(try_script); + u3z(catch_script); + u3z(return_script); + u3z(fail_script); + u3z(global_set_script); + u3z(global_get_script); + u3z(mem_grow_script); + u3z(mem_size_script); + u3z(get_acc_script); + u3z(set_acc_script); + u3z(get_all_glob_script); + u3z(set_all_glob_script); + + match_data_struct match = { + call_bat, + memread_bat, + memwrite_bat, + call_ext_bat, + try_bat, + catch_bat, + return_bat, + fail_bat, + global_set_bat, + global_get_bat, + mem_grow_bat, + mem_size_bat, + get_acc_bat, + set_acc_bat, + get_all_glob_bat, + set_all_glob_bat, + // + call_ctx, + memread_ctx, + memwrite_ctx, + global_set_ctx, + global_get_ctx, + mem_grow_ctx, + mem_size_ctx, + get_all_glob_ctx, + set_all_glob_ctx, + }; + + lia_state sat; + + BoxArena = &sat.box_arena; + CodeArena = &sat.code_arena; + + u3_noun yil; + if (!omit_t) + { + sat.is_stateful = 1; + if (_get_state(hint, seed, &sat)) + { + sat.map = u3t(u3at(seed_import, seed)); + sat.match = &match; + sat.resolution = u3_none; + yil = _apply_diff(input_tag, p_input, &sat); + } + else + { // instantiate state with retries + u3_noun octs = u3at(seed_module, seed_new); + u3_noun p_octs, q_octs; + u3x_cell(octs, &p_octs, &q_octs); + c3_w bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs + : u3m_bail(c3__fail); + c3_y* bin_y; + M3Result result; + IM3Environment wasm3_env; + IM3Runtime wasm3_runtime = NULL; + IM3Module wasm3_module; + + _uw_arena_init(CodeArena); + _uw_arena_init(BoxArena); + + m3_SetAllocators(_calloc_box, _free_box, _realloc_box); + m3_SetTransientAllocators(_calloc_code, _free_code, _realloc_code); + m3_SetMemoryAllocators(u3a_calloc, u3a_free, u3a_realloc); + jmp_buf esc; + CodeArena->esc_u = BoxArena->esc_u = &esc; + c3_i jmp_i; + + while (1) + { + if (0 == (jmp_i = setjmp(esc))) + { + bin_y = _calloc_box(bin_len_w, 1); + u3r_bytes(0, bin_len_w, bin_y, u3x_atom(q_octs)); + + wasm3_env = m3_NewEnvironment(); + if (!wasm3_env) + { + fprintf(stderr, ERR("env is null")); + return u3m_bail(c3__fail); + } + + wasm3_runtime = m3_NewRuntime( + wasm3_env, + 1 << 21, + NULL, + 1 /* suspend */ + ); + if (!wasm3_runtime) + { + fprintf(stderr, ERR("runtime is null")); + return u3m_bail(c3__fail); + } + + result = m3_ParseModule(wasm3_env, &wasm3_module, bin_y, bin_len_w); + if (result) + { + fprintf(stderr, ERR("parse binary error: %s"), result); + return u3m_bail(c3__fail); + } + + result = m3_LoadModule(wasm3_runtime, wasm3_module); + if (result) + { + fprintf(stderr, ERR("load module error: %s"), result); + return u3m_bail(c3__fail); + } + + result = m3_ValidateModule(wasm3_module); + if (result) + { + fprintf(stderr, ERR("validation error: %s"), result); + return u3m_bail(c3__fail); + } + + c3_w n_imports = wasm3_module->numFuncImports; + u3_noun lia_shop = u3at(seed_shop, seed_new); + u3_noun import = u3at(seed_import, seed_new); + + u3_noun acc, map; + u3x_cell(import, &acc, &map); + { + sat.yil_previous = u3_none; + sat.queue = u3_nul; + sat.wasm_module = wasm3_module; + sat.lia_shop = u3qb_flop(lia_shop); + sat.acc = u3k(acc); + sat.map = map; + sat.match = &match; + sat.arrow_yil = u3_none; + sat.susp_list = u3_nul; + sat.resolution = u3_none; + } + + for (c3_w i = 0; i < n_imports; i++) + { + M3Function f = wasm3_module->functions[i]; + const char* mod = f.import.moduleUtf8; + const char* name = f.import.fieldUtf8; + + result = m3_LinkRawFunctionEx( + wasm3_module, mod, name, + NULL, &_link_wasm_with_arrow_map, + &sat + ); + + if (result) + { + fprintf(stderr, ERR("link error: %s"), result); + return u3m_bail(c3__fail); + } + } + + result = m3_CompileModule(wasm3_module); + if (result) + { + fprintf(stderr, ERR("compilation error: %s"), result); + return u3m_bail(c3__fail); + } + + break; + } + else + { + // escaped, grow arena and retry + if (wasm3_runtime) + { + u3a_free(wasm3_runtime->memory.mallocated); + } + + if (jmp_i == c3__box) + { + _uw_arena_grow(BoxArena); + _uw_arena_reset(CodeArena); + } + else if (jmp_i == c3__code) + { + _uw_arena_grow(CodeArena); + _uw_arena_reset(BoxArena); + } + else + { + return u3m_bail(c3__fail); + } + + continue; + } + } + + wasm3_runtime->base = BoxArena->buf_y; + wasm3_runtime->base_transient = CodeArena->buf_y; + // sanity check: struct and code allocators should not be used + // when running wasm + m3_SetAllocators(_calloc_bail, _free_bail, _realloc_bail); + m3_SetTransientAllocators(_calloc_bail, _free_bail, _realloc_bail); + + result = m3_RunStart(wasm3_module); + + if (result == m3Err_ComputationBlock) + { + yil = sat.arrow_yil; + sat.arrow_yil = u3_none; + if (yil == u3_none) + { + return u3m_bail(c3__fail); + } + } + else if (_deterministic_trap(result)) + { + fprintf(stderr, WUT("start function call trapped: %s"), result); + yil = u3nc(2, 0); + } + else if (result == m3Err_functionImportMissing) + { + return u3m_bail(c3__exit); + } + else if (result) + { + fprintf(stderr, ERR("start function failed: %s"), result); + return u3m_bail(c3__fail); + } + else + { + u3_noun monad = u3at(seed_past, seed_new); + yil = _reduce_monad(u3k(monad), &sat); + } + } + + _move_state(&sat, seed, seed_new, hint, yil); + } + else + { + sat.is_stateful = 0; + M3Result result; + IM3Environment wasm3_env; + IM3Runtime wasm3_runtime = NULL; + IM3Module wasm3_module; + u3_noun p_octs, q_octs; + + u3_noun octs = u3at(seed_module, seed_new); + u3x_cell(octs, &p_octs, &q_octs); + c3_w bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs + : u3m_bail(c3__fail); + c3_y* bin_y = u3r_bytes_alloc(0, bin_len_w, u3x_atom(q_octs)); + + m3_SetAllocators(u3a_calloc, u3a_free, u3a_realloc); + m3_SetTransientAllocators(u3a_calloc, u3a_free, u3a_realloc); + m3_SetMemoryAllocators(u3a_calloc, u3a_free, u3a_realloc); + + wasm3_env = m3_NewEnvironment(); + if (!wasm3_env) + { + fprintf(stderr, ERR("env is null")); + return u3m_bail(c3__fail); + } + + // 2MB stack + wasm3_runtime = m3_NewRuntime(wasm3_env, 1 << 21, NULL, 0 /* suspend */); + if (!wasm3_runtime) + { + fprintf(stderr, ERR("runtime is null")); + return u3m_bail(c3__fail); + } + + // save the stack to restore it later before calling m3_FreeRuntime + // since it is allocated and freed seperately; no need to do it in + // stateful code branch since there we will allocate and free + // whole arena + + void* stk_u = wasm3_runtime->stack; + + result = m3_ParseModule(wasm3_env, &wasm3_module, bin_y, bin_len_w); + if (result) + { + fprintf(stderr, ERR("parse binary error: %s"), result); + return u3m_bail(c3__fail); + } + + result = m3_LoadModule(wasm3_runtime, wasm3_module); + if (result) + { + fprintf(stderr, ERR("load module error: %s"), result); + return u3m_bail(c3__fail); + } + + result = m3_ValidateModule(wasm3_module); + if (result) + { + fprintf(stderr, ERR("validation error: %s"), result); + return u3m_bail(c3__fail); + } + + c3_w n_imports = wasm3_module->numFuncImports; + u3_noun lia_shop = u3at(seed_shop, seed_new); + u3_noun import = u3at(seed_import, seed_new); + + u3_noun acc, map; + u3x_cell(import, &acc, &map); + { + sat.yil_previous = u3_none; + sat.queue = u3_none; + sat.wasm_module = wasm3_module; + sat.lia_shop = u3qb_flop(lia_shop); + sat.acc = u3k(acc); + sat.map = map; + sat.match = &match; + sat.arrow_yil = u3_none; + sat.susp_list = u3_none; + sat.resolution = u3_none; + } + + for (c3_w i = 0; i < n_imports; i++) + { + M3Function f = wasm3_module->functions[i]; + const char* mod = f.import.moduleUtf8; + const char* name = f.import.fieldUtf8; + + result = m3_LinkRawFunctionEx( + wasm3_module, mod, name, + NULL, &_link_wasm_with_arrow_map, + &sat + ); + + if (result) + { + fprintf(stderr, ERR("link error: %s"), result); + return u3m_bail(c3__fail); + } + } + + // don't compile module since here we don't care about the ordering + // of code pages when we don't suspend, the functions will + // get compiled on call + // + + result = m3_RunStart(wasm3_module); + + if (result == m3Err_ComputationBlock) + { + yil = sat.arrow_yil; + sat.arrow_yil = u3_none; + if (yil == u3_none) + { + return u3m_bail(c3__fail); + } + } + else if (_deterministic_trap(result)) + { + fprintf(stderr, WUT("start function call trapped: %s"), result); + yil = u3nc(2, 0); + } + else if (result == m3Err_functionImportMissing) + { + return u3m_bail(c3__exit); + } + else if (result) + { + fprintf(stderr, ERR("start function failed: %s"), result); + return u3m_bail(c3__fail); + } + else + { + u3_noun monad = u3at(seed_past, seed_new); + yil = _reduce_monad(u3k(monad), &sat); + } + + wasm3_runtime->stack = stk_u; + m3_FreeRuntime(wasm3_runtime); + m3_FreeEnvironment(wasm3_env); + u3a_free(bin_y); + } + + // any of these could be u3_none + // + { + u3z(sat.lia_shop); + u3z(sat.susp_list); + u3z(sat.yil_previous); + u3z(sat.queue); + } + + u3z(match.call_bat); + u3z(match.memread_bat); + u3z(match.memwrite_bat); + u3z(match.call_ext_bat); + u3z(match.try_bat); + u3z(match.catch_bat); + u3z(match.return_bat); + u3z(match.fail_bat); + u3z(match.global_set_bat); + u3z(match.global_get_bat); + u3z(match.mem_grow_bat); + u3z(match.mem_size_bat); + + u3z(match.call_ctx); + u3z(match.memread_ctx); + u3z(match.memwrite_ctx); + u3z(global_set_ctx); + u3z(global_get_ctx); + u3z(mem_grow_ctx); + u3z(mem_size_ctx); + + #ifdef URWASM_SUBROAD + // exit subroad, copying the result + u3_noun pro = u3m_love(u3nc(u3nc(yil, sat.acc), seed_new)); + #else + u3_noun pro = u3nc(u3nc(yil, sat.acc), seed_new); + #endif + + return pro; + +#endif // URWASM_STATEFUL +} + + +u3_weak +u3we_lia_run_once(u3_noun cor) +{ + if (c3__none == u3at(u3x_sam_6, cor)) + { + return u3_none; + } + + #ifdef URWASM_SUBROAD + // enter subroad, 4MB safety buffer + u3m_hate(1 << 20); + #endif + + u3_noun ctx = u3at(ONCE_CTX, cor); + u3r_mug(ctx); + + u3_noun runnable = uw_kick_nock(u3k(ctx), AX_RUNNABLE); + u3_noun arrows = KICK1(uw_kick_nock(u3k(ctx), AX_ARROWS)); + + u3_noun call_script = KICK1(uw_kick_nock(u3k(arrows), AX_CALL)); + u3_noun memread_script = KICK1(uw_kick_nock(u3k(arrows), AX_MEMREAD)); + u3_noun memwrite_script = KICK1(uw_kick_nock(u3k(arrows), AX_MEMWRITE)); + u3_noun call_ext_script = KICK1(uw_kick_nock(u3k(arrows), AX_CALL_EXT)); + u3_noun global_set_script = KICK1(uw_kick_nock(u3k(arrows), AX_GLOBAL_SET)); + u3_noun global_get_script = KICK1(uw_kick_nock(u3k(arrows), AX_GLOBAL_GET)); + u3_noun mem_grow_script = KICK1(uw_kick_nock(u3k(arrows), AX_MEM_GROW)); + u3_noun mem_size_script = uw_kick_nock(u3k(arrows), AX_MEM_SIZE); + u3_noun get_acc_script = uw_kick_nock(u3k(arrows), AX_GET_ACC); + u3_noun set_acc_script = KICK1(uw_kick_nock(u3k(arrows), AX_SET_ACC)); + u3_noun get_all_glob_script = uw_kick_nock(u3k(arrows), AX_GET_ALL_GLOB); + u3_noun set_all_glob_script = KICK1(uw_kick_nock( arrows, AX_SET_ALL_GLOB)); + + u3_noun try_script = KICK2(uw_kick_nock(u3k(runnable), AX_TRY)); + u3_noun catch_script = KICK2(uw_kick_nock(u3k(runnable), AX_CATCH)); + u3_noun return_script = KICK1(uw_kick_nock(u3k(runnable), AX_RETURN)); + u3_noun fail_script = uw_kick_nock( runnable, AX_FAIL); + + u3_noun call_bat = u3k(u3h(call_script)); + u3_noun memread_bat = u3k(u3h(memread_script)); + u3_noun memwrite_bat = u3k(u3h(memwrite_script)); + u3_noun call_ext_bat = u3k(u3h(call_ext_script)); + u3_noun try_bat = u3k(u3h(try_script)); + u3_noun catch_bat = u3k(u3h(catch_script)); + u3_noun return_bat = u3k(u3h(return_script)); + u3_noun fail_bat = u3k(u3h(fail_script)); + u3_noun global_set_bat = u3k(u3h(global_set_script)); + u3_noun global_get_bat = u3k(u3h(global_get_script)); + u3_noun mem_grow_bat = u3k(u3h(mem_grow_script)); + u3_noun mem_size_bat = u3k(u3h(mem_size_script)); + u3_noun get_acc_bat = u3k(u3h(get_acc_script)); + u3_noun set_acc_bat = u3k(u3h(set_acc_script)); + u3_noun get_all_glob_bat = u3k(u3h(get_all_glob_script)); + u3_noun set_all_glob_bat = u3k(u3h(set_all_glob_script)); + + u3_noun call_ctx = u3k(u3at(ARROW_CTX, call_script)); + u3_noun memread_ctx = u3k(u3at(ARROW_CTX, memread_script)); + u3_noun memwrite_ctx = u3k(u3at(ARROW_CTX, memwrite_script)); + u3_noun global_set_ctx = u3k(u3at(ARROW_CTX, global_set_script)); + u3_noun global_get_ctx = u3k(u3at(ARROW_CTX, global_get_script)); + u3_noun mem_grow_ctx = u3k(u3at(ARROW_CTX, mem_grow_script)); + u3_noun mem_size_ctx = u3k(u3at(MONAD_CTX, mem_size_script)); + u3_noun get_all_glob_ctx = u3k(u3at(MONAD_CTX, get_all_glob_script)); + u3_noun set_all_glob_ctx = u3k(u3at(ARROW_CTX, set_all_glob_script)); + + u3z(call_script); + u3z(memread_script); + u3z(memwrite_script); + u3z(call_ext_script); + u3z(try_script); + u3z(catch_script); + u3z(return_script); + u3z(fail_script); + u3z(global_set_script); + u3z(global_get_script); + u3z(mem_grow_script); + u3z(mem_size_script); + u3z(get_acc_script); + u3z(set_acc_script); + u3z(get_all_glob_script); + u3z(set_all_glob_script); + + + match_data_struct match = { + call_bat, + memread_bat, + memwrite_bat, + call_ext_bat, + try_bat, + catch_bat, + return_bat, + fail_bat, + global_set_bat, + global_get_bat, + mem_grow_bat, + mem_size_bat, + get_acc_bat, + set_acc_bat, + get_all_glob_bat, + set_all_glob_bat, + // + call_ctx, + memread_ctx, + memwrite_ctx, + global_set_ctx, + global_get_ctx, + mem_grow_ctx, + mem_size_ctx, + get_all_glob_ctx, + set_all_glob_ctx, + }; + + u3_noun octs = u3at(u3x_sam_4, cor); + u3_noun p_octs, q_octs; + u3x_cell(octs, &p_octs, &q_octs); + + c3_w bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs : u3m_bail(c3__fail); + c3_y* bin_y = u3r_bytes_alloc(0, bin_len_w, u3x_atom(q_octs)); + + M3Result result; + + m3_SetAllocators(u3a_calloc, u3a_free, u3a_realloc); + m3_SetTransientAllocators(u3a_calloc, u3a_free, u3a_realloc); + m3_SetMemoryAllocators(u3a_calloc, u3a_free, u3a_realloc); + + IM3Environment wasm3_env = m3_NewEnvironment(); + if (!wasm3_env) + { + fprintf(stderr, ERR("env is null")); + return u3m_bail(c3__fail); + } + + // 2MB stack + IM3Runtime wasm3_runtime = m3_NewRuntime( + wasm3_env, + 1 << 21, + NULL, + 0 /* suspend */ + ); + if (!wasm3_runtime) + { + fprintf(stderr, ERR("runtime is null")); + return u3m_bail(c3__fail); + } + + void* stk_u = wasm3_runtime->stack; + + IM3Module wasm3_module; + result = m3_ParseModule(wasm3_env, &wasm3_module, bin_y, bin_len_w); + if (result) + { + fprintf(stderr, ERR("parse binary error: %s"), result); + return u3m_bail(c3__fail); + } + + result = m3_LoadModule(wasm3_runtime, wasm3_module); + if (result) + { + fprintf(stderr, ERR("load module error: %s"), result); + return u3m_bail(c3__fail); + } + + result = m3_ValidateModule(wasm3_module); + if (result) + { + fprintf(stderr, ERR("validation error: %s"), result); + return u3m_bail(c3__fail); + } + + c3_w n_imports = wasm3_module->numFuncImports; + u3_noun monad = u3at(u3x_sam_7, cor); + u3_noun import = u3at(u3x_sam_5, cor); + + u3_noun acc, map; + u3x_cell(import, &acc, &map); + + lia_state sat = { + wasm3_module, + u3_nul, + u3k(acc), + map, + &match, + u3_none, + u3_none, + u3_none + }; + + sat.is_stateful = 0; + + for (c3_w i = 0; i < n_imports; i++) + { + M3Function f = wasm3_module->functions[i]; + const char * mod = f.import.moduleUtf8; + const char * name = f.import.fieldUtf8; + + result = m3_LinkRawFunctionEx( + wasm3_module, mod, name, + NULL, &_link_wasm_with_arrow_map, + (void *)&sat + ); + + if (result) + { + fprintf(stderr, ERR("link error: %s"), result); + return u3m_bail(c3__fail); + } + } + + u3_noun yil; + + result = m3_RunStart(wasm3_module); + + if (result == m3Err_ComputationBlock) + { + yil = sat.arrow_yil; + sat.arrow_yil = u3_none; + if (yil == u3_none) + { + return u3m_bail(c3__fail); + } + } + else if (_deterministic_trap(result)) + { + fprintf(stderr, WUT("start function call trapped: %s"), result); + yil = u3nc(2, 0); + } + else if (result == m3Err_functionImportMissing) + { + return u3m_bail(c3__exit); + } + else if (result) + { + fprintf(stderr, ERR("start function failed: %s"), result); + return u3m_bail(c3__fail); + } + else + { + yil = _reduce_monad(u3k(monad), &sat); + } + + wasm3_runtime->stack = stk_u; + m3_FreeRuntime(wasm3_runtime); + m3_FreeEnvironment(wasm3_env); + + u3a_free(bin_y); + + u3z(match.call_bat); + u3z(match.memread_bat); + u3z(match.memwrite_bat); + u3z(match.call_ext_bat); + u3z(match.try_bat); + u3z(match.catch_bat); + u3z(match.return_bat); + u3z(match.fail_bat); + u3z(match.global_set_bat); + u3z(match.global_get_bat); + u3z(match.mem_grow_bat); + u3z(match.mem_size_bat); + u3z(match.get_acc_bat); + u3z(match.set_acc_bat); + u3z(match.get_all_glob_bat); + u3z(match.set_all_glob_bat); + + u3z(match.call_ctx); + u3z(match.memread_ctx); + u3z(match.memwrite_ctx); + u3z(global_set_ctx); + u3z(global_get_ctx); + u3z(mem_grow_ctx); + u3z(mem_size_ctx); + u3z(get_all_glob_ctx); + u3z(set_all_glob_ctx); + + #ifdef URWASM_SUBROAD + // exit subroad, copying the result + u3_noun pro = u3m_love(u3nc(yil, sat.acc)); + #else + u3_noun pro = u3nc(yil, sat.acc); + #endif + + return pro; +} diff --git a/vere/pkg/noun/jets/e/zlib.c b/vere/pkg/noun/jets/e/zlib.c new file mode 100644 index 0000000..89937df --- /dev/null +++ b/vere/pkg/noun/jets/e/zlib.c @@ -0,0 +1,225 @@ +/// @file + +#include <allocate.h> +#include <stdio.h> +#include "zlib.h" + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static void* +zlib_malloc(voidpf opaque, uInt items, uInt size) +{ + size_t len = items * size; + void* result = u3a_malloc(len); + return result; +} + +static void +zlib_free(voidpf opaque, voidpf address) +{ + u3a_free(address); +} + +u3_noun +_decompress(u3_atom pos, u3_noun octs, int window_bits) +{ + u3_atom p_octs = u3h(octs); + u3_atom q_octs = u3t(octs); + + c3_w p_octs_w, pos_w; + + if ( c3n == u3r_safe_word(p_octs, &p_octs_w) ) { + return u3_none; + } + if (c3n == u3r_safe_word(pos, &pos_w)) { + return u3_none; + } + + c3_w len_w = u3r_met(3, q_octs); + + int leading_zeros = 0; + + if (p_octs_w > len_w) { + leading_zeros = p_octs_w - len_w; + } + else { + len_w = p_octs_w; + } + + // Bytestream exhausted + // + if (pos_w >= len_w) { + return u3_none; + } + + c3_y* input; + + if (c3y == u3a_is_cat(q_octs)) { + input = (c3_y*)&q_octs + pos_w; + } + else { + u3a_atom* vat_u = u3a_to_ptr(q_octs); + input = (c3_y*)vat_u->buf_w + pos_w; + } + + int ret; + z_stream strm; + + if (pos_w < len_w) { + strm.avail_in = (len_w - pos_w); + } + else { + strm.avail_in = 0; + } + + strm.zalloc = zlib_malloc; + strm.zfree = zlib_free; + strm.opaque = Z_NULL; + strm.next_in = input; + + ret = inflateInit2(&strm, window_bits); + + if (ret != Z_OK) { + u3l_log("%i", ret); + u3l_log("%s", strm.msg); + return u3m_bail(c3__exit); + } + + c3_w chunk_w = len_w / 10; + u3i_slab sab_u; + +#define INIT_SZ 16384 + strm.avail_out = INIT_SZ; + u3i_slab_init(&sab_u, 3, INIT_SZ); + strm.next_out = sab_u.buf_y; + + void* this_address = strm.next_out; + +#define ZEROS_SZ 256 + c3_y zeros[ZEROS_SZ]; + + if (leading_zeros) { + memset(zeros, 0, ZEROS_SZ); + } + + while ((ret = inflate(&strm, Z_FINISH)) == Z_BUF_ERROR) { + + // Output exhausted: reallocate + // + if (strm.avail_out == 0) { + strm.avail_out = chunk_w; + + u3i_slab_grow(&sab_u, 3, strm.total_out + chunk_w); + strm.next_out = sab_u.buf_y + strm.total_out; + } + + // Input exhausted: input leading zeros? + // + if (strm.avail_in == 0) { + + if (leading_zeros) { + // Position in the stream exceeded atom bytes, + // but is still below stream length + // + if (strm.total_in + pos_w >= len_w + && strm.total_in + pos_w < p_octs_w) { + + c3_w rem_w = p_octs_w - (strm.total_in + pos_w); + strm.next_in = zeros; + + if (rem_w > ZEROS_SZ) { + strm.avail_in = ZEROS_SZ; + } + else { + strm.avail_in = rem_w; + } + } + else { + u3l_log("%i", ret); + u3l_log("%s", strm.msg); + inflateEnd(&strm); + u3i_slab_free(&sab_u); + return u3m_bail(c3__exit); + } + } + else { + u3l_log("%i", ret); + u3l_log("%s", strm.msg); + inflateEnd(&strm); + u3i_slab_free(&sab_u); + return u3m_bail(c3__exit); + } + } + } + if (ret != Z_STREAM_END) { + u3l_log("%i", ret); + u3l_log("%s", strm.msg); + inflateEnd(&strm); + u3i_slab_free(&sab_u); + return u3m_bail(c3__exit); + } + ret = inflateEnd(&strm); + + if (ret != Z_OK) { + u3l_log("%i", ret); + u3l_log("%s", strm.msg); + u3i_slab_free(&sab_u); + return u3m_bail(c3__exit); + } + + u3_noun decompressed_octs = u3nc(strm.total_out, u3i_slab_mint(&sab_u)); + u3_noun new_pos = pos_w + strm.total_in; + u3_noun new_stream = u3nc(u3i_word(new_pos), u3k(octs)); + + return u3nc(decompressed_octs, new_stream); +} + +u3_noun +u3qe_decompress_gzip(u3_atom pos, u3_noun octs) +{ + return _decompress(pos, octs, 31); +} +u3_noun +u3qe_decompress_zlib(u3_atom pos, u3_noun octs) +{ + return _decompress(pos, octs, 15); +} + +u3_noun +u3we_decompress_gzip(u3_noun cor) +{ + u3_atom pos; + u3_noun octs; + + u3_noun a = u3r_at(u3x_sam, cor); + u3x_cell(a, &pos, &octs); + + if(_(u3a_is_atom(pos)) && _(u3a_is_cell(octs))) { + return u3qe_decompress_gzip(pos, octs); + } + + else { + return u3m_bail(c3__exit); + } +} + +u3_noun +u3we_decompress_zlib(u3_noun cor) +{ + u3_atom pos; + u3_noun octs; + + u3_noun a = u3r_at(u3x_sam, cor); + u3x_cell(a, &pos, &octs); + + if(_(u3a_is_atom(pos)) && _(u3a_is_cell(octs))) { + return u3qe_decompress_zlib(pos, octs); + } + + else { + return u3m_bail(c3__exit); + } +} diff --git a/vere/pkg/noun/jets/f/cell.c b/vere/pkg/noun/jets/f/cell.c new file mode 100644 index 0000000..0a818f2 --- /dev/null +++ b/vere/pkg/noun/jets/f/cell.c @@ -0,0 +1,29 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_cell(u3_noun hed, + u3_noun tal) + { + if ( (c3__void == hed) || (c3__void == tal) ) { + return c3__void; + } else { + return u3nt(c3__cell, u3k(hed), u3k(tal)); + } + } + u3_noun + u3wf_cell(u3_noun cor) + { + u3_noun hed, tal; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &hed, u3x_sam_3, &tal, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_cell(hed, tal); + } + } diff --git a/vere/pkg/noun/jets/f/comb.c b/vere/pkg/noun/jets/f/comb.c new file mode 100644 index 0000000..1dfe794 --- /dev/null +++ b/vere/pkg/noun/jets/f/comb.c @@ -0,0 +1,70 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_comb(u3_noun mal, + u3_noun buz) + { + if ( (u3_none == mal) || (u3_none == buz) ) { + return u3_none; + } + else { + u3_noun p_mal, q_mal, p_buz, q_buz, pp_buz, pq_buz; + + if ( (c3y == u3r_p(mal, 0, &p_mal)) && (0 != p_mal) ) { + if ( (c3y == u3r_p(buz, 0, &p_buz)) && (0 != p_buz) ) { + return u3nc(0, + u3qc_peg(p_mal, p_buz)); + } + else if ( c3y == u3r_pq(buz, 2, &p_buz, &q_buz) && + c3y == u3r_p(p_buz, 0, &pp_buz) && + c3y == u3r_p(q_buz, 0, &pq_buz) ) + { + return u3nt(2, + u3nc(0, + u3qc_peg(p_mal, pp_buz)), + u3nc(0, + u3qc_peg(p_mal, pq_buz))); + } + else return u3nt(7, + u3k(mal), + u3k(buz)); + } +#if 1 + else if ( (c3y == u3r_bush(mal, &p_mal, &q_mal)) && + (c3y == u3du(p_mal)) && + (c3y == u3du(q_mal)) && + (0 == u3h(q_mal)) && + (1 == u3t(q_mal)) ) + { + return u3nt(8, + u3k(p_mal), + u3k(buz)); + } +#endif + else if ( (c3y == u3r_p(buz, 0, &p_buz)) && + (c3y == u3r_sing(1, p_buz)) ) + { + return u3k(mal); + } + else return u3nt(7, + u3k(mal), + u3k(buz)); + } + } + u3_noun + u3wf_comb(u3_noun cor) + { + u3_noun mal, buz; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &mal, u3x_sam_3, &buz, 0) ) { + return u3_none; + } else { + return u3qf_comb(mal, buz); + } + } diff --git a/vere/pkg/noun/jets/f/cons.c b/vere/pkg/noun/jets/f/cons.c new file mode 100644 index 0000000..45719c1 --- /dev/null +++ b/vere/pkg/noun/jets/f/cons.c @@ -0,0 +1,54 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_cons(u3_noun vur, + u3_noun sed) + { + u3_noun p_vur, p_sed; + + if ( c3y == u3r_p(vur, 1, &p_vur) && + c3y == u3r_p(sed, 1, &p_sed) ) { + return u3nt(1, + u3k(p_vur), + u3k(p_sed)); + } +#if 0 + else if ( c3y == u3r_p(vur, 0, &p_vur) && + c3y == u3r_p(sed, 0, &p_sed) && + !(c3y == u3r_sing(1, p_vur)) && + !(c3y == u3r_sing(p_vur, p_sed)) && + (0 == u3r_nord(p_vur, p_sed)) ) + { + u3_atom fub = u3qa_div(p_vur, 2); + u3_atom nof = u3qa_div(p_sed, 2); + + if ( c3y == u3r_sing(fub, nof) ) { + u3z(nof); + + return u3nc(0, fub); + } + else { + u3z(fub); + u3z(nof); + } + } +#endif + return u3nc(u3k(vur), u3k(sed)); + } + u3_noun + u3wf_cons(u3_noun cor) + { + u3_noun vur, sed; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_cons(vur, sed); + } + } diff --git a/vere/pkg/noun/jets/f/core.c b/vere/pkg/noun/jets/f/core.c new file mode 100644 index 0000000..ca7e93d --- /dev/null +++ b/vere/pkg/noun/jets/f/core.c @@ -0,0 +1,118 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_core(u3_noun pac, + u3_noun con) + { + if ( (c3__void == pac) ) { + return c3__void; + } else { + { + u3_noun p_con, q_con, r_con, hr_con, tr_con; + + u3r_trel(con, &p_con, &q_con, &r_con); + u3r_cell(r_con, &hr_con, &tr_con); + if ( (c3y == u3du(hr_con)) && + (u3_nul == u3h(hr_con)) && + (u3_nul == u3t(hr_con)) ) + { + u3l_log("old core"); + abort(); + } + } + return u3nt(c3__core, u3k(pac), u3k(con)); + } + } + u3_noun + u3wf_core(u3_noun cor) + { + u3_noun pac, con; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &pac, u3x_sam_3, &con, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_core(pac, con); + } + } + +#if 0 + static void + _fork_test(const c3_c *lab_c, u3_noun set) + { + if ( u3_nul == set ) { + return; + } else { + u3_noun n_set, l_set, r_set; + + u3x_trel(set, &n_set, &l_set, &r_set); + + u3qf_test(lab_c, n_set); + _fork_test(lab_c, l_set); + _fork_test(lab_c, r_set); + } + } + void + u3qf_test(const c3_c* lab_c, u3_noun sut) + { + u3_noun p_sut, q_sut; + + if ( c3n == u3du(sut) ) switch ( sut ) { + default: u3m_bail(c3__fail); return; + + case c3__noun: + { + return; + } + case c3__void: + { + return; + } + } + else switch ( u3h(sut) ) { + default: u3m_bail(c3__fail); return; + + case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + return; + } + case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3qf_test(lab_c, p_sut); + u3qf_test(lab_c, q_sut); + return; + } + case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3qf_test(lab_c, p_sut); + return; + } + case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3qf_test(lab_c, q_sut); + return; + } + case c3__fork: p_sut = u3t(sut); + { + _fork_test(lab_c, p_sut); + return; + } + case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3qf_test(lab_c, q_sut); + u3qf_test(lab_c, u3h(p_sut)); + return; + } + case c3__hold: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3qf_test(lab_c, p_sut); + return; + } + } + } +#endif diff --git a/vere/pkg/noun/jets/f/face.c b/vere/pkg/noun/jets/f/face.c new file mode 100644 index 0000000..7e689e7 --- /dev/null +++ b/vere/pkg/noun/jets/f/face.c @@ -0,0 +1,31 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_face(u3_noun sag, + u3_noun tip) + { + if ( c3__void == tip ) { + return c3__void; + } + else return u3nt(c3__face, + u3k(sag), + u3k(tip)); + } + u3_noun + u3wf_face(u3_noun cor) + { + u3_noun sag, tip; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_face(sag, tip); + } + } + diff --git a/vere/pkg/noun/jets/f/fine.c b/vere/pkg/noun/jets/f/fine.c new file mode 100644 index 0000000..2c5a85c --- /dev/null +++ b/vere/pkg/noun/jets/f/fine.c @@ -0,0 +1,35 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_fine(u3_noun fuv, + u3_noun lup, + u3_noun mar) + { + if ( (c3__void == lup) || (c3__void == mar) ) { + return c3__void; + } else { + return u3nq(c3__fine, + u3k(fuv), + u3k(lup), + u3k(mar)); + } + } + u3_noun + u3wf_fine(u3_noun cor) + { + u3_noun fuv, lup, mar; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &fuv, + u3x_sam_6, &lup, + u3x_sam_7, &mar, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_fine(fuv, lup, mar); + } + } diff --git a/vere/pkg/noun/jets/f/fitz.c b/vere/pkg/noun/jets/f/fitz.c new file mode 100644 index 0000000..b1c2a5d --- /dev/null +++ b/vere/pkg/noun/jets/f/fitz.c @@ -0,0 +1,75 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +static u3_noun +_fitz_fiz(u3_noun yaz, + u3_noun wix) +{ + c3_w yaz_w = u3r_met(3, yaz); + c3_w wix_w = u3r_met(3, wix); + c3_y yaz_y, wix_y; + + yaz_y = (0 == yaz_w) ? 0 : u3r_byte((yaz_w - 1), yaz); + if ( (yaz_y < 'A') || (yaz_y > 'Z') ) yaz_y = 0; + + wix_y = (0 == wix_w) ? 0 : u3r_byte((wix_w - 1), wix); + if ( (wix_y < 'A') || (wix_y > 'Z') ) wix_y = 0; + + if ( yaz_y && wix_y ) { + if ( wix_y > yaz_y ) { + return c3n; + } + } + + return c3y; +} + +u3_noun +u3qf_fitz(u3_noun yaz, + u3_noun wix) +{ + c3_w yet_w = u3r_met(3, yaz); + c3_w wet_w = u3r_met(3, wix); + + c3_w i_w, met_w = c3_min(yet_w, wet_w); + + if ( c3n == _fitz_fiz(yaz, wix) ) { + return c3n; + } + for ( i_w = 0; i_w < met_w; i_w++ ) { + c3_y yaz_y = u3r_byte(i_w, yaz); + c3_y wix_y = u3r_byte(i_w, wix); + + if ( (i_w == (yet_w - 1)) && (yaz_y >= 'A') && (yaz_y <= 'Z')) { + return c3y; + } + + if ( (i_w == (wet_w - 1)) && (wix_y >= 'A') && (wix_y <= 'Z')) { + return c3y; + } + + if ( yaz_y != wix_y ) { + return c3n; + } + } + return c3y; +} + +u3_noun +u3wf_fitz(u3_noun cor) +{ + u3_noun yaz, wix; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &yaz, u3x_sam_3, &wix, 0)) || + (c3n == u3ud(yaz)) || + (c3n == u3ud(wix)) ) + { + return u3m_bail(c3__fail); + } else { + return u3qf_fitz(yaz, wix); + } +} diff --git a/vere/pkg/noun/jets/f/flan.c b/vere/pkg/noun/jets/f/flan.c new file mode 100644 index 0000000..319e1f0 --- /dev/null +++ b/vere/pkg/noun/jets/f/flan.c @@ -0,0 +1,47 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_flan(u3_noun bos, + u3_noun nif) + { + if ( c3y == u3r_sing(bos, nif) ) { + return u3k(bos); + } + if ( c3y == u3r_sing(1, u3h(bos)) ) { + if ( (u3_nul == u3t(bos)) ) { + return u3k(nif); + } + else return u3k(bos); + } + else { + if ( c3y == u3r_sing(1, u3h(nif)) ) { + if ( (u3_nul == u3t(nif)) ) { + return u3k(bos); + } + else return u3k(nif); + } + else { + return u3nq(6, + u3k(bos), + u3k(nif), + u3nc(1, c3n)); + } + } + } + u3_noun + u3wf_flan_139(u3_noun cor) + { + u3_noun bos, nif; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_flan(bos, nif); + } + } diff --git a/vere/pkg/noun/jets/f/flip.c b/vere/pkg/noun/jets/f/flip.c new file mode 100644 index 0000000..9eb922e --- /dev/null +++ b/vere/pkg/noun/jets/f/flip.c @@ -0,0 +1,39 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_flip(u3_noun hel) + { + if ( c3y == u3r_sing(1, u3h(hel)) ) { + if ( (c3y == u3t(hel)) ) { + return u3nc(1, c3n); + } + else { + u3_assert((c3n == u3t(hel))); + + return u3nc(1, c3y); + } + } + else { + return u3nq(6, + u3k(hel), + u3nc(1, c3n), + u3nc(1, c3y)); + } + } + u3_noun + u3wf_flip_139(u3_noun cor) + { + u3_noun hel; + + if ( u3_none == (hel = u3r_at(u3x_sam, cor)) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_flip(hel); + } + } diff --git a/vere/pkg/noun/jets/f/flor.c b/vere/pkg/noun/jets/f/flor.c new file mode 100644 index 0000000..031168e --- /dev/null +++ b/vere/pkg/noun/jets/f/flor.c @@ -0,0 +1,47 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_flor(u3_noun bos, + u3_noun nif) + { + if ( c3y == u3r_sing(bos, nif) ) { + return u3k(bos); + } + if ( c3y == u3r_sing(1, u3h(bos)) ) { + if ( (u3_nul == u3t(bos)) ) { + return u3k(bos); + } + else return u3k(nif); + } + else { + if ( c3y == u3r_sing(1, u3h(nif)) ) { + if ( (u3_nul == u3t(nif)) ) { + return u3k(nif); + } + else return u3k(bos); + } + else { + return u3nq(6, + u3k(bos), + u3nc(1, c3y), + u3k(nif)); + } + } + } + u3_noun + u3wf_flor_139(u3_noun cor) + { + u3_noun bos, nif; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_flor(bos, nif); + } + } diff --git a/vere/pkg/noun/jets/f/fork.c b/vere/pkg/noun/jets/f/fork.c new file mode 100644 index 0000000..b2a68eb --- /dev/null +++ b/vere/pkg/noun/jets/f/fork.c @@ -0,0 +1,79 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_forq(u3_noun hoz, + u3_noun bur) + { + if ( c3y == u3r_sing(hoz, bur) ) { + return u3k(hoz); + } + else if ( c3__void == bur ) { + return u3k(hoz); + } + else if ( c3__void == hoz ) { + return u3k(bur); + } + else return u3kf_fork(u3nt(u3k(hoz), u3k(bur), u3_nul)); + } + + u3_noun + u3qf_fork(u3_noun yed) + { + u3_noun lez = u3_nul; + + while ( u3_nul != yed ) { + u3_noun i_yed = u3h(yed); + + if ( c3__void != i_yed ) { + if ( (c3y == u3du(i_yed)) && (c3__fork == u3h(i_yed)) ) { + lez = u3kdi_uni(lez, u3k(u3t(i_yed))); + } + else { + lez = u3kdi_put(lez, u3k(i_yed)); + } + } + + yed = u3t(yed); + } + + if ( u3_nul == lez ) { + return c3__void; + } + else if ( (u3_nul == u3h(u3t(lez))) && (u3_nul == u3t(u3t(lez))) ) { + u3_noun ret = u3k(u3h(lez)); + + u3z(lez); + return ret; + } + else { + return u3nc(c3__fork, lez); + } + } + + u3_noun + u3wf_fork(u3_noun cor) + { + u3_noun yed; + + if ( c3n == u3r_mean(cor, u3x_sam, &yed, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_fork(yed); + } + } + + u3_noun + u3kf_fork(u3_noun yed) + { + u3_noun ret = u3qf_fork(yed); + + u3z(yed); + return ret; + } diff --git a/vere/pkg/noun/jets/f/help.c b/vere/pkg/noun/jets/f/help.c new file mode 100644 index 0000000..41fe7fb --- /dev/null +++ b/vere/pkg/noun/jets/f/help.c @@ -0,0 +1,31 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_help(u3_noun sag, + u3_noun tip) + { + if ( c3__void == tip ) { + return c3__void; + } + else return u3nt(c3__help, + u3k(sag), + u3k(tip)); + } + u3_noun + u3wf_help(u3_noun cor) + { + u3_noun sag, tip; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_help(sag, tip); + } + } + diff --git a/vere/pkg/noun/jets/f/hint.c b/vere/pkg/noun/jets/f/hint.c new file mode 100644 index 0000000..175c3fb --- /dev/null +++ b/vere/pkg/noun/jets/f/hint.c @@ -0,0 +1,32 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_hint(u3_noun sag, + u3_noun tip) + { + if ( c3__void == tip ) { + return c3__void; + } + if ( c3__noun == tip ) { + return c3__noun; + } + else return u3nt(c3__hint, u3k(sag), u3k(tip)); + } + u3_noun + u3wf_hint(u3_noun cor) + { + u3_noun sag, tip; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_hint(sag, tip); + } + } + diff --git a/vere/pkg/noun/jets/f/look.c b/vere/pkg/noun/jets/f/look.c new file mode 100644 index 0000000..e50e914 --- /dev/null +++ b/vere/pkg/noun/jets/f/look.c @@ -0,0 +1,134 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + +/* internals +*/ + static u3_noun + _look_in(u3_noun cog, + u3_noun dab, + u3_atom axe) + { + if ( u3_nul == dab ) { + return u3_nul; + } + else { + u3_noun n_dab, l_dab, r_dab; + + u3r_trel(dab, &n_dab, &l_dab, &r_dab); + if ( c3n == u3du(n_dab) ) { + // return u3m_bail(c3__fail); + u3l_log("bad look"); + return u3m_bail(c3__exit) ; + } + else { + u3_noun pn_dab = u3h(n_dab); + u3_noun qn_dab = u3t(n_dab); + + if ( (u3_nul == l_dab) && (u3_nul == r_dab) ) { + if ( (c3y == u3du(qn_dab)) && + (c3y == u3r_sing(cog, pn_dab)) ) { + return u3nt(u3_nul, + u3k(axe), + u3k(qn_dab)); + } + else { + return u3_nul; + } + } + else if ( (u3_nul == l_dab) ) { + if ( (c3y == u3du(qn_dab)) && + (c3y == u3r_sing(cog, pn_dab)) ) { + return u3nt(u3_nul, + u3qc_peg(axe, 2), + u3k(qn_dab)); + } + else { + if ( c3y == u3qc_gor(cog, pn_dab) ) { + return u3_nul; + } + else { + u3_noun pro; + + axe = u3qc_peg(axe, 3); + pro = _look_in(cog, r_dab, axe); + u3z(axe); + return pro; + } + } + } + else if ( (u3_nul == r_dab) ) { + if ( (c3y == u3du(qn_dab)) && + (c3y == u3r_sing(cog, pn_dab)) ) { + return u3nt(u3_nul, + u3qc_peg(axe, 2), + u3k(qn_dab)); + } + else { + if ( c3y == u3qc_gor(cog, pn_dab) ) { + u3_noun pro; + + axe = u3qc_peg(axe, 3); + pro = _look_in(cog, l_dab, axe); + u3z(axe); + return pro; + } + else { + return u3_nul; + } + } + } + else { + if ( (c3y == u3du(qn_dab)) && + (c3y == u3r_sing(cog, pn_dab)) ) { + return u3nt(u3_nul, + u3qc_peg(axe, 2), + u3k(qn_dab)); + } + else { + if ( c3y == u3qc_gor(cog, pn_dab) ) { + u3_noun pro; + + axe = u3qc_peg(axe, 6); + pro = _look_in(cog, l_dab, axe); + u3z(axe); + return pro; + } + else { + u3_noun pro; + + axe = u3qc_peg(axe, 7); + pro = _look_in(cog, r_dab, axe); + u3z(axe); + return pro; + } + } + } + } + } + } + + + + + u3_noun + u3qf_look(u3_noun cog, + u3_noun dab) + { + return _look_in(cog, dab, 1); + } + u3_noun + u3wf_look(u3_noun cor) + { + u3_noun cog, dab; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_look(cog, dab); + } + } diff --git a/vere/pkg/noun/jets/f/loot.c b/vere/pkg/noun/jets/f/loot.c new file mode 100644 index 0000000..d1a7bef --- /dev/null +++ b/vere/pkg/noun/jets/f/loot.c @@ -0,0 +1,133 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + +/* internals +*/ + static u3_noun + _loot_in(u3_noun cog, + u3_noun dom, + u3_atom axe) + { + if ( u3_nul == dom ) { + return u3_nul; + } + else { + u3_noun n_dom, l_dom, r_dom; + + u3r_trel(dom, &n_dom, &l_dom, &r_dom); + if ( c3n == u3du(n_dom) ) { + return u3m_bail(c3__fail); + } + else { + u3_noun qqn_dom = u3t(u3t(n_dom)); + u3_noun yep = u3qf_look(cog, qqn_dom); + + if ( (u3_nul == l_dom) && (u3_nul == r_dom) ) { + if ( u3_nul == yep ) { + return u3_nul; + } else { + u3_noun u_yep = u3t(yep); + u3_noun pro; + + pro = u3nt(u3_nul, u3qc_peg(axe, u3h(u_yep)), u3k(u3t(u_yep))); + u3z(yep); + return pro; + } + } + else if ( (u3_nul == l_dom) ) { + if ( u3_nul == yep ) { + u3_noun nax = u3qc_peg(axe, 3); + u3_noun pro; + + pro = _loot_in(cog, r_dom, nax); + u3z(nax); + return pro; + } + else { + u3_noun u_yep = u3t(yep); + u3_noun nax = u3qc_peg(axe, 2); + u3_noun pro; + + pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep))); + u3z(nax); + u3z(yep); + return pro; + } + } + else if ( (u3_nul == r_dom) ) { + if ( u3_nul == yep ) { + u3_noun nax = u3qc_peg(axe, 3); + u3_noun pro; + + pro = _loot_in(cog, l_dom, nax); + u3z(nax); + return pro; + } + else { + u3_noun u_yep = u3t(yep); + u3_noun nax = u3qc_peg(axe, 2); + u3_noun pro; + + pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep))); + u3z(nax); + u3z(yep); + return pro; + } + } + else { + if ( u3_nul == yep ) { + u3_noun nax = u3qc_peg(axe, 6); + u3_noun pey; + + pey = _loot_in(cog, l_dom, nax); + u3z(nax); + + if ( u3_nul != pey ) { + return pey; + } + else { + u3_noun nax = u3qc_peg(axe, 7); + u3_noun pro; + + pro = _loot_in(cog, r_dom, nax); + u3z(nax); + return pro; + } + } + else { + u3_noun u_yep = u3t(yep); + u3_noun nax = u3qc_peg(axe, 2); + u3_noun pro; + + pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep))); + u3z(nax); + u3z(yep); + return pro; + } + } + } + } + } + + u3_noun + u3qf_loot(u3_noun cog, + u3_noun dom) + { + return _loot_in(cog, dom, 1); + } + u3_noun + u3wf_loot(u3_noun cor) + { + u3_noun cog, dom; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_loot(cog, dom); + } + } diff --git a/vere/pkg/noun/jets/f/ut_crop.c b/vere/pkg/noun/jets/f/ut_crop.c new file mode 100644 index 0000000..189564d --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_crop.c @@ -0,0 +1,34 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_crop(u3_noun cor) +{ + u3_noun bat, sut, ref, van; + + if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__crop + ((!!vet) << 8); + u3_noun key = u3z_key_3(fun_m, sut, ref, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_fish.c b/vere/pkg/noun/jets/f/ut_fish.c new file mode 100644 index 0000000..e8acbd4 --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_fish.c @@ -0,0 +1,35 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_fish(u3_noun cor) +{ + u3_noun bat, sut, axe, van; + + if ( (c3n == u3r_mean(cor, u3x_sam, &axe, u3x_con, &van, 0)) + || (c3n == u3ud(axe)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__fish + ((!!vet) << 8); + u3_noun key = u3z_key_3(fun_m, sut, axe, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_fuse.c b/vere/pkg/noun/jets/f/ut_fuse.c new file mode 100644 index 0000000..8e4e1a6 --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_fuse.c @@ -0,0 +1,34 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_fuse(u3_noun cor) +{ + u3_noun bat, sut, ref, van; + + if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__fuse + ((!!vet) << 8); + u3_noun key = u3z_key_3(fun_m, sut, ref, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_mint.c b/vere/pkg/noun/jets/f/ut_mint.c new file mode 100644 index 0000000..618e729 --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_mint.c @@ -0,0 +1,36 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_mint(u3_noun cor) +{ + u3_noun bat, sut, gol, gen, van; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol, + u3x_sam_3, &gen, + u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + c3_m fun_m = 141 + c3__mint; + u3_noun vet = u3r_at(u3qfu_van_vet, van); + u3_noun key = u3z_key_5(fun_m, vet, sut, gol, gen, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_mull.c b/vere/pkg/noun/jets/f/ut_mull.c new file mode 100644 index 0000000..767ab3c --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_mull.c @@ -0,0 +1,37 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_mull(u3_noun cor) +{ + u3_noun bat, sut, gol, dox, gen, van; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol, + u3x_sam_6, &dox, + u3x_sam_7, &gen, + u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__mull + ((!!vet) << 8); + u3_noun key = u3z_key_5(fun_m, sut, gol, dox, gen, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_nest.c b/vere/pkg/noun/jets/f/ut_nest.c new file mode 100644 index 0000000..9bc53bf --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_nest.c @@ -0,0 +1,50 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_nest_dext(u3_noun dext_core) +{ + u3_noun nest_in_core, nest_core; + u3_noun bat, sut, ref, van, seg, reg, gil; + + if ( (u3_none == (nest_in_core = u3r_at(3, dext_core))) + || (c3n == u3r_mean(nest_in_core, u3x_sam_2, &seg, + u3x_sam_6, ®, + u3x_sam_7, &gil, + u3x_con, &nest_core, 0)) + || (c3n == u3r_mean(nest_core, u3x_sam_3, &ref, + u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__dext + ((!!vet) << 8); + u3_noun key = u3z_key_3(fun_m, sut, ref, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(dext_core), u3k(u3x_at(u3x_bat, dext_core))); + + if ( ((c3y == pro) && (u3_nul == reg)) || + ((c3n == pro) && (u3_nul == seg)) ) + { + return u3z_save(u3z_memo_toss, key, pro); + } + else { + u3z(key); + return pro; + } + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_redo.c b/vere/pkg/noun/jets/f/ut_redo.c new file mode 100644 index 0000000..43fb06c --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_redo.c @@ -0,0 +1,34 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_redo(u3_noun cor) +{ + u3_noun bat, sut, ref, van; + + if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__redo + ((!!vet) << 8); + u3_noun key = u3z_key_3(fun_m, sut, ref, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/f/ut_rest.c b/vere/pkg/noun/jets/f/ut_rest.c new file mode 100644 index 0000000..87ff60f --- /dev/null +++ b/vere/pkg/noun/jets/f/ut_rest.c @@ -0,0 +1,34 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3wfu_rest(u3_noun cor) +{ + u3_noun bat, sut, leg, van; + + if ( (c3n == u3r_mean(cor, u3x_sam, &leg, u3x_con, &van, 0)) + || (u3_none == (bat = u3r_at(u3x_bat, van))) + || (u3_none == (sut = u3r_at(u3x_sam, van))) ) + { + return u3m_bail(c3__fail); + } + else { + u3_weak vet = u3r_at(u3qfu_van_vet, van); + c3_m fun_m = 141 + c3__rest + ((!!vet) << 8); + u3_noun key = u3z_key_3(fun_m, sut, leg, bat); + u3_weak pro = u3z_find(u3z_memo_toss, key); + + if ( u3_none != pro ) { + u3z(key); + return pro; + } + else { + pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor))); + return u3z_save(u3z_memo_toss, key, pro); + } + } +} diff --git a/vere/pkg/noun/jets/g/plot.c b/vere/pkg/noun/jets/g/plot.c new file mode 100644 index 0000000..18c8ab0 --- /dev/null +++ b/vere/pkg/noun/jets/g/plot.c @@ -0,0 +1,364 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +// XX optimize +// +static c3_w +_met_plat_m(c3_g a_g, c3_w fum_w, c3_w met_w, u3_atom vat) +{ + c3_w len_w, wor_w; + + { + u3i_slab sab_u; + u3i_slab_init(&sab_u, a_g, met_w); + u3r_chop(a_g, fum_w, met_w, 0, sab_u.buf_w, vat); + + len_w = sab_u.len_w; + + while ( len_w && !sab_u.buf_w[len_w - 1] ) { + len_w--; + } + + wor_w = !len_w ? 0 : sab_u.buf_w[len_w - 1]; + + u3i_slab_free(&sab_u); + } + + + if ( !len_w ) { + return 0; + } + + { + c3_w gal_w = len_w - 1; + c3_w daz_w = wor_w; + c3_y a_y = a_g; + + // inlined from u3r_met + if (a_y < 5) { + c3_y max_y = (1 << a_y) - 1; + c3_y gow_y = 5 - a_y; + + if (gal_w > ((UINT32_MAX - (32 + max_y)) >> gow_y)) { + return u3m_bail(c3__fail); + } + + return (gal_w << gow_y) + + ((c3_bits_word(daz_w) + max_y) + >> a_y); + } + + { + c3_y gow_y = (a_y - 5); + return ((gal_w + 1) + ((1 << gow_y) - 1)) >> gow_y; + } + } +} + +static c3_w +_met_list(c3_g a_g, + c3_w sep_w, + u3_noun b_p); + +static c3_w +_met_pair(c3_g* las_g, + c3_w sep_w, + u3_noun a_p, + u3_noun b_p, + c3_g* new_g) +{ + c3_g res_g, a_g; + + while ( c3y == u3a_is_cell(a_p) ) { + sep_w = _met_pair(las_g, sep_w, u3h(a_p), u3t(a_p), &res_g); + las_g = &res_g; + a_p = u3h(b_p); + b_p = u3t(b_p); + } + + if ( !_(u3a_is_cat(a_p)) || (a_p >= 32) ) { + return u3m_bail(c3__fail); + } + + a_g = (c3_g)a_p; + + if ( las_g && (a_g != *las_g) ) { + sep_w = u3qc_rig_s(*las_g, sep_w, a_g); // XX overflow + } + + *new_g = a_g; + return _met_list(a_g, sep_w, b_p); +} + +static c3_w +_met_list(c3_g a_g, + c3_w sep_w, + u3_noun b_p) +{ + if ( u3_nul != b_p ) { + c3_w met_w; + u3_noun i, t = b_p; + + do { + u3x_cell(t, &i, &t); + + // ?@ i.b.p + if ( c3y == u3a_is_atom(i) ) { + met_w = u3r_met(a_g, i); + sep_w += met_w; // XX overflow + } + else { + u3_noun i_i, t_i; + u3x_cell(i, &i_i, &t_i); + + // ?=(@ -.i.b.p) + if ( c3y == u3a_is_atom(i_i) ) { + if ( !_(u3a_is_cat(i_i)) ) { + return u3m_bail(c3__fail); + } + + met_w = (c3_w)i_i; + sep_w += met_w; // XX overflow + } + else { + u3_noun l, r; + c3_o cel_o = u3r_cell(i_i, &l, &r); + + // ?=([%c ~] -.i.b.p) + if ( (c3y == cel_o) && ('c' == l) && (u3_nul == r) ) { + u3_atom p_p_t_i = u3x_atom(u3h(u3h(t_i))); + u3_atom q_p_t_i = u3x_atom(u3t(u3h(t_i))); + u3_atom q_t_i = u3x_atom(u3t(t_i)); + + if ( !_(u3a_is_cat(p_p_t_i)) + || !_(u3a_is_cat(q_p_t_i)) + || !_(u3a_is_cat(q_t_i)) ) + { + return u3m_bail(c3__fail); + } + + met_w = (c3_w)q_p_t_i; + sep_w += met_w; // XX overflow + } + // ?=([%m ~] -.i.b.p) + else if ( (c3y == cel_o) && ('m' == l) && (u3_nul == r) ) { + u3_atom p_p_t_i = u3x_atom(u3h(u3h(t_i))); + u3_atom q_p_t_i = u3x_atom(u3t(u3h(t_i))); + u3_atom q_t_i = u3x_atom(u3t(t_i)); + + if ( !_(u3a_is_cat(p_p_t_i)) + || !_(u3a_is_cat(q_p_t_i)) + || !_(u3a_is_cat(q_t_i)) ) + { + return u3m_bail(c3__fail); + } + + met_w = _met_plat_m(a_g, (c3_w)p_p_t_i, (c3_w)q_p_t_i, q_t_i); + sep_w += met_w; // XX overflow + } + // ?=([%s ~] -.i.b.p) (assumed) + else { + c3_g new_g; + u3x_cell(t_i, &l, &r); + + sep_w = _met_pair(&a_g, sep_w, l, r, &new_g); + + if ( new_g != a_g ) { + sep_w = u3qc_rig_s(new_g, sep_w, a_g); // XX overflow + } + } + } + } + } + while ( u3_nul != t ); + } + + return sep_w; +} + +static c3_w +_fax_list(u3i_slab* sab_u, + c3_g a_g, + c3_w sep_w, + u3_noun b_p); + +static c3_w +_fax_pair(u3i_slab* sab_u, + c3_g* las_g, + c3_w sep_w, + u3_noun a_p, + u3_noun b_p, + c3_g* new_g) +{ + c3_g res_g, a_g; + + while ( c3y == u3a_is_cell(a_p) ) { + sep_w = _fax_pair(sab_u, las_g, sep_w, u3h(a_p), u3t(a_p), &res_g); + las_g = &res_g; + a_p = u3h(b_p); + b_p = u3t(b_p); + } + + if ( !_(u3a_is_cat(a_p)) || (a_p >= 32) ) { + return u3m_bail(c3__fail); + } + + a_g = (c3_g)a_p; + + if ( las_g && (a_g != *las_g) ) { + sep_w = u3qc_rig_s(*las_g, sep_w, a_g); // XX overflow + } + + *new_g = a_g; + return _fax_list(sab_u, a_g, sep_w, b_p); +} + +static c3_w +_fax_list(u3i_slab* sab_u, + c3_g a_g, + c3_w sep_w, + u3_noun b_p) +{ + if ( u3_nul != b_p ) { + c3_w met_w; + u3_noun i, t = b_p; + + do { + u3x_cell(t, &i, &t); + + // ?@ i.b.p + if ( c3y == u3a_is_atom(i) ) { + met_w = u3r_met(a_g, i); + + u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_w, i); + + sep_w += met_w; // XX overflow + } + else { + u3_noun i_i, t_i; + u3x_cell(i, &i_i, &t_i); + + // ?=(@ -.i.b.p) + if ( c3y == u3a_is_atom(i_i) ) { + if ( !_(u3a_is_cat(i_i)) ) { + return u3m_bail(c3__fail); + } + + met_w = (c3_w)i_i; + + u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_w, u3x_atom(t_i)); + + sep_w += met_w; // XX overflow + } + else { + u3_noun l, r; + c3_o cel_o = u3r_cell(i_i, &l, &r); + + // ?=([%c ~] -.i.b.p) + if ( (c3y == cel_o) && ('c' == l) && (u3_nul == r) ) { + u3_atom p_p_t_i = u3x_atom(u3h(u3h(t_i))); + u3_atom q_p_t_i = u3x_atom(u3t(u3h(t_i))); + u3_atom q_t_i = u3x_atom(u3t(t_i)); + + if ( !_(u3a_is_cat(p_p_t_i)) + || !_(u3a_is_cat(q_p_t_i)) + || !_(u3a_is_cat(q_t_i)) ) + { + return u3m_bail(c3__fail); + } + + met_w = (c3_w)q_p_t_i; + + u3r_chop(a_g, (c3_w)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); + + sep_w += met_w; // XX overflow + } + // ?=([%m ~] -.i.b.p) + else if ( (c3y == cel_o) && ('m' == l) && (u3_nul == r) ) { + u3_atom p_p_t_i = u3x_atom(u3h(u3h(t_i))); + u3_atom q_p_t_i = u3x_atom(u3t(u3h(t_i))); + u3_atom q_t_i = u3x_atom(u3t(t_i)); + + if ( !_(u3a_is_cat(p_p_t_i)) + || !_(u3a_is_cat(q_p_t_i)) + || !_(u3a_is_cat(q_t_i)) ) + { + return u3m_bail(c3__fail); + } + + met_w = _met_plat_m(a_g, (c3_w)p_p_t_i, (c3_w)q_p_t_i, q_t_i); + + u3r_chop(a_g, (c3_w)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); + + sep_w += met_w; // XX overflow + } + // ?=([%s ~] -.i.b.p) (assumed) + else { + c3_g new_g; + u3x_cell(t_i, &l, &r); + + sep_w = _fax_pair(sab_u, &a_g, sep_w, l, r, &new_g); + + if ( new_g != a_g ) { + sep_w = u3qc_rig_s(new_g, sep_w, a_g); // XX overflow + } + } + } + } + } + while ( u3_nul != t ); + } + + return sep_w; +} + +u3_noun +u3qg_plot_met(u3_noun a_p, u3_noun b_p) +{ + c3_g out_g; + c3_w sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); + + return u3nc(out_g, u3i_word(sep_w)); +} + +u3_noun +u3wg_plot_met(u3_noun cor) +{ + u3_noun a_p, b_p; + { + u3_noun sam = u3h(u3t(cor)); + a_p = u3h(sam); + b_p = u3t(sam); + } + return u3qg_plot_met(a_p, b_p); +} + +u3_noun +u3qg_plot_fax(u3_noun a_p, u3_noun b_p) +{ + c3_g out_g; + c3_w sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); + u3i_slab sab_u; + + u3i_slab_init(&sab_u, out_g, sep_w); + + _fax_pair(&sab_u, NULL, 0, a_p, b_p, &out_g); + + return u3nt(u3i_slab_mint(&sab_u), out_g, u3i_word(sep_w)); +} + +u3_noun +u3wg_plot_fax(u3_noun cor) +{ + u3_noun a_p, b_p; + { + u3_noun sam = u3h(u3t(cor)); + a_p = u3h(sam); + b_p = u3t(sam); + } + return u3qg_plot_fax(a_p, b_p); +} diff --git a/vere/pkg/noun/jets/i/lagoon.c b/vere/pkg/noun/jets/i/lagoon.c new file mode 100644 index 0000000..db7088b --- /dev/null +++ b/vere/pkg/noun/jets/i/lagoon.c @@ -0,0 +1,3315 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "c3/motes.h" + +#include "noun.h" +#include "softfloat.h" +#include "softblas.h" + +#include <math.h> // for pow() +#include <stdio.h> + +#define f16_ceil(a) f16_roundToInt( a, softfloat_round_max, false ) +#define f32_ceil(a) f32_roundToInt( a, softfloat_round_max, false ) +#define f64_ceil(a) f64_roundToInt( a, softfloat_round_max, false ) +#define f128M_ceil(a, b) f128M_roundToInt( a, softfloat_round_max, false, b ) + + union half { + float16_t h; + c3_w c; + }; + + union sing { + float32_t s; + c3_w c; + }; + + union doub { + float64_t d; + c3_d c; + }; + + union quad { + float128_t q; + c3_d c[2]; + }; + + // $?(%n %u %d %z %a) + static inline void + _set_rounding(c3_w a) + { + // We could use SoftBLAS set_rounding() to set the SoftFloat + // mode as well, but it's more explicit to do it here since + // we may use SoftFloat in any given Lagoon jet and we want + // you, dear developer, to see it set here. + switch ( a ) + { + default: + u3m_bail(c3__fail); + break; + // %n - near + case c3__n: + softfloat_roundingMode = softfloat_round_near_even; + softblas_roundingMode = 'n'; + break; + // %z - zero + case c3__z: + softfloat_roundingMode = softfloat_round_minMag; + softblas_roundingMode = 'z'; + break; + // %u - up + case c3__u: + softfloat_roundingMode = softfloat_round_max; + softblas_roundingMode = 'u'; + break; + // %d - down + case c3__d: + softfloat_roundingMode = softfloat_round_min; + softblas_roundingMode = 'd'; + break; + // %a - away + case c3__a: + softfloat_roundingMode = softfloat_round_near_maxMag; + softblas_roundingMode = 'a'; + break; + } + } + +/* length of shape = x * y * z * w * ... +*/ + static inline c3_d _get_length(u3_noun shape) + { + c3_d len = 1; + while (u3_nul != shape) { + len = len * u3x_atom(u3h(shape)); + shape = u3t(shape); + } + return len; + } + +/* get dims from shape as array [x y z w ...] +*/ + static inline c3_d* _get_dims(u3_noun shape) + { + u3_atom len = u3qb_lent(shape); + c3_d len_d = u3r_chub(0, len); + c3_d* dims = (c3_d*)u3a_malloc(len_d*sizeof(c3_d)); + for (c3_d i = 0; i < len_d; i++) { + dims[i] = u3r_chub(0, u3x_atom(u3h(shape))); + shape = u3t(shape); + } + u3z(len); + return dims; + } + +/* check consistency of array shape and bloq size + |= =ray + ^- ? + .= (roll shape.meta.ray ^mul) + (dec (met bloq.meta.ray data.ray)) +*/ + static inline c3_o _check(u3_noun ray) + { + // Calculate expected size. + u3_atom shp = u3h(u3h(ray)); // (reported) shape of ray, +4 + u3_atom blq = u3h(u3t(u3h(ray))); // block size of ray, +10 + u3_atom sin = _get_length(shp); // calculated length of ray + + // Calculate actual size. + u3_atom len = u3r_met(blq, u3t(ray)); // length of ray + u3_atom dex = u3qa_dec(len); // decrement length b/c of pinned 1 + + return __(sin == dex); + } + +/* add - axpy = 1*x+y +*/ + u3_noun + u3qi_la_add_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq + ) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + haxpy(len_x, (float16_t){SB_REAL16_ONE}, (float16_t*)x_bytes, 1, (float16_t*)y_bytes, 1); + break; + + case 5: + saxpy(len_x, (float32_t){SB_REAL32_ONE}, (float32_t*)x_bytes, 1, (float32_t*)y_bytes, 1); + break; + + case 6: + daxpy(len_x, (float64_t){SB_REAL64_ONE}, (float64_t*)x_bytes, 1, (float64_t*)y_bytes, 1); + break; + + case 7: + qaxpy(len_x, (float128_t){SB_REAL128L_ONE,SB_REAL128U_ONE}, (float128_t*)x_bytes, 1, (float128_t*)y_bytes, 1); + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* sub - axpy = -1*y+x +*/ + u3_noun + u3qi_la_sub_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq + ) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + haxpy(len_x, (float16_t){SB_REAL16_NEGONE}, (float16_t*)x_bytes, 1, (float16_t*)y_bytes, 1); + break; + + case 5: + saxpy(len_x, (float32_t){SB_REAL32_NEGONE}, (float32_t*)x_bytes, 1, (float32_t*)y_bytes, 1); + break; + + case 6: + daxpy(len_x, (float64_t){SB_REAL64_NEGONE}, (float64_t*)x_bytes, 1, (float64_t*)y_bytes, 1); + break; + + case 7: + qaxpy(len_x, (float128_t){SB_REAL128L_NEGONE,SB_REAL128U_NEGONE}, (float128_t*)x_bytes, 1, (float128_t*)y_bytes, 1); + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + + +/* mul - x.*y + elementwise multiplication +*/ + u3_noun + u3qi_la_mul_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + ((float16_t*)y_bytes)[i] = f16_mul(((float16_t*)x_bytes)[i], ((float16_t*)y_bytes)[i]); + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + ((float32_t*)y_bytes)[i] = f32_mul(((float32_t*)x_bytes)[i], ((float32_t*)y_bytes)[i]); + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + ((float64_t*)y_bytes)[i] = f64_mul(((float64_t*)x_bytes)[i], ((float64_t*)y_bytes)[i]); + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + f128M_mul(&(((float128_t*)y_bytes)[i]), &(((float128_t*)x_bytes)[i]), &(((float128_t*)y_bytes)[i])); + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* div - x/y + elementwise division +*/ + u3_noun + u3qi_la_div_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + ((float16_t*)y_bytes)[i] = f16_div(((float16_t*)x_bytes)[i], ((float16_t*)y_bytes)[i]); + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + ((float32_t*)y_bytes)[i] = f32_div(((float32_t*)x_bytes)[i], ((float32_t*)y_bytes)[i]); + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + ((float64_t*)y_bytes)[i] = f64_div(((float64_t*)x_bytes)[i], ((float64_t*)y_bytes)[i]); + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + f128M_div(&(((float128_t*)y_bytes)[i]), &(((float128_t*)x_bytes)[i]), &(((float128_t*)y_bytes)[i])); + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* mod - x % y = x - r*floor(x/r) + remainder after division +*/ + u3_noun + u3qi_la_mod_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + float16_t y_val16 = ((float16_t*)y_bytes)[i]; + // Perform division x/n + float16_t div_result16 = f16_div(x_val16, y_val16); + // Compute floor of the division result + c3_ds floor_result16 = f16_to_i64(div_result16, softfloat_round_minMag, false); + float16_t floor_float16 = i64_to_f16(floor_result16); + // Multiply n by floor(x/n) + float16_t mult_result16 = f16_mul(y_val16, floor_float16); + // Compute remainder: x - n * floor(x/n) + ((float16_t*)y_bytes)[i] = f16_sub(x_val16, mult_result16); + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + float32_t y_val32 = ((float32_t*)y_bytes)[i]; + // Perform division x/n + float32_t div_result32 = f32_div(x_val32, y_val32); + // Compute floor of the division result + c3_ds floor_result32 = f32_to_i64(div_result32, softfloat_round_minMag, false); + float32_t floor_float32 = i64_to_f32(floor_result32); + // Multiply n by floor(x/n) + float32_t mult_result32 = f32_mul(y_val32, floor_float32); + // Compute remainder: x - n * floor(x/n) + ((float32_t*)y_bytes)[i] = f32_sub(x_val32, mult_result32); + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + float64_t y_val64 = ((float64_t*)y_bytes)[i]; + // Perform division x/n + float64_t div_result64 = f64_div(x_val64, y_val64); + // Compute floor of the division result + c3_ds floor_result64 = f64_to_i64(div_result64, softfloat_round_minMag, false); + float64_t floor_float64 = i64_to_f64(floor_result64); + // Multiply n by floor(x/n) + float64_t mult_result64 = f64_mul(y_val64, floor_float64); + // Compute remainder: x - n * floor(x/n) + ((float64_t*)y_bytes)[i] = f64_sub(x_val64, mult_result64); + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + float128_t y_val128 = ((float128_t*)y_bytes)[i]; + // Perform division x/n + float128_t div_result128; + f128M_div((float128_t*)&x_val128, (float128_t*)&y_val128, (float128_t*)&div_result128); + // Compute floor of the division result + c3_ds floor_result128 = f128M_to_i64(&div_result128, softfloat_round_minMag, false); + float128_t floor_float128; + i64_to_f128M(floor_result128, &floor_float128); + // Multiply n by floor(x/n) + float128_t mult_result128; + f128M_mul(((float128_t*)&y_val128), ((float128_t*)&floor_float128), ((float128_t*)&mult_result128)); + // Compute remainder: x - n * floor(x/n) + f128M_sub(((float128_t*)&x_val128), ((float128_t*)&mult_result128), &(((float128_t*)y_bytes)[i])); + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* cumsum - x[0] + x[1] + ... x[n] +*/ + u3_noun + u3qi_la_cumsum_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // y_bytes is the data array (w/ leading 0x1, skipped by for range) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + + u3_noun r_data; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: { + float16_t sum16[2]; + sum16[0] = (float16_t){SB_REAL16_ZERO}; + for (c3_d i = len_x; i > 0; i--) { + sum16[0] = f16_add(sum16[0], ((float16_t*)x_bytes)[i-1]); + } + sum16[1].v = 0x1; + r_data = u3i_bytes((2+1)*sizeof(c3_y), (c3_y*)sum16); + break;} + + case 5: { + float32_t sum32[2]; + sum32[0] = (float32_t){SB_REAL32_ZERO}; + for (c3_d i = len_x; i > 0; i--) { + sum32[0] = f32_add(sum32[0], ((float32_t*)x_bytes)[i-1]); + } + sum32[1].v = 0x1; + r_data = u3i_bytes((4+1)*sizeof(c3_y), (c3_y*)sum32); + break;} + + case 6: { + float64_t sum64[2]; + sum64[0] = (float64_t){SB_REAL64_ZERO}; + for (c3_d i = len_x; i > 0; i--) { + sum64[0] = f64_add(sum64[0], ((float64_t*)x_bytes)[i-1]); + } + sum64[1].v = 0x1; + r_data = u3i_bytes((8+1)*sizeof(c3_y), (c3_y*)sum64); + break;} + + case 7: { + float128_t sum128[2]; + sum128[0] = (float128_t){SB_REAL128L_ZERO, SB_REAL128U_ZERO}; + for (c3_d i = len_x; i > 0; i--) { + f128M_add(&(sum128[0]), &(((float128_t*)x_bytes)[i-1]), &(sum128[0])); + } + sum128[1] = (float128_t){0x1, 0x0}; + r_data = u3i_bytes((16+1)*sizeof(c3_y), (c3_y*)sum128); + break;} + } + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* argmin - argmin(x) +*/ + u3_noun + u3qi_la_argmin_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1, which doesn't matter here) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + c3_w min_idx = 0; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: { + float16_t min_val16 = ((float16_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f16_lt(((float16_t*)x_bytes)[i], min_val16)) { + min_val16 = ((float16_t*)x_bytes)[i]; + min_idx = (len_x - i - 1); + } + } + break;} + + case 5: { + float32_t min_val32 = ((float32_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f32_lt(((float32_t*)x_bytes)[i], min_val32)) { + min_val32 = ((float32_t*)x_bytes)[i]; + min_idx = (len_x - i - 1); + } + } + break;} + + case 6: { + float64_t min_val64 = ((float64_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f64_lt(((float64_t*)x_bytes)[i], min_val64)) { + min_val64 = ((float64_t*)x_bytes)[i]; + min_idx = (len_x - i - 1); + } + } + break;} + + case 7: { + float128_t min_val128 = ((float128_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f128M_lt(&(((float128_t*)x_bytes)[i]), &min_val128)) { + min_val128 = *f128M_min(&min_val128, &((float128_t*)x_bytes)[i]); + min_idx = (len_x - i - 1); + } + } + break;} + } + + u3_noun r_data = u3i_chub(min_idx); + + return r_data; + } + +/* argmax - argmax(x) +*/ + u3_noun + u3qi_la_argmax_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1, which doesn't matter here) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + c3_w max_idx = 0; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: { + float16_t max_val16 = ((float16_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f16_gt(((float16_t*)x_bytes)[i], max_val16)) { + max_val16 = ((float16_t*)x_bytes)[i]; + max_idx = (len_x - i - 1); + } + } + break;} + + case 5: { + float32_t max_val32 = ((float32_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f32_gt(((float32_t*)x_bytes)[i], max_val32)) { + max_val32 = ((float32_t*)x_bytes)[i]; + max_idx = (len_x - i - 1); + } + } + break;} + + case 6: { + float64_t max_val64 = ((float64_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f64_gt(((float64_t*)x_bytes)[i], max_val64)) { + max_val64 = ((float64_t*)x_bytes)[i]; + max_idx = (len_x - i - 1); + } + } + break;} + + case 7: { + float128_t max_val128 = ((float128_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + if(f128M_gt(&(((float128_t*)x_bytes)[i]), &max_val128)) { + max_val128 = *f128M_max(&max_val128, &((float128_t*)x_bytes)[i]); + max_idx = (len_x - i - 1); + } + } + break;} + } + + u3_noun r_data = u3i_chub(max_idx); + + return r_data; + } + +/* ravel - x -> ~[x[0], x[1], ... x[n]] + entire nd-array busted out as a linear list +*/ + u3_noun + u3qi_la_ravel_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // r_data is the result noun of [data] + u3_noun r_data = u3_nul; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + r_data = u3nc(u3i_word(x_val16.v), r_data); + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + r_data = u3nc(u3i_word(x_val32.v), r_data); + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + r_data = u3nc(u3i_chub(x_val64.v), r_data); + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + r_data = u3nc(u3i_chubs(2, (c3_d*)&(x_val128.v)), r_data); + } + break; + } + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* min - min(x,y) +*/ + u3_noun + u3qi_la_min_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by for range) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + + u3_noun r_data; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: { + float16_t min_val16 = ((float16_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + min_val16 = f16_min(min_val16, ((float16_t*)x_bytes)[i]); + } + float16_t r16[2]; + r16[0] = min_val16; + r16[1].v = 0x1; + r_data = u3i_bytes((2+1)*sizeof(c3_y), (c3_y*)r16); + break;} + + case 5: { + float32_t min_val32 = ((float32_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + min_val32 = f32_min(min_val32, ((float32_t*)x_bytes)[i]); + } + float32_t r32[2]; + r32[0] = min_val32; + r32[1].v = 0x1; + r_data = u3i_bytes((4+1)*sizeof(c3_y), (c3_y*)r32); + break;} + + case 6: { + float64_t min_val64 = ((float64_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + min_val64 = f64_min(min_val64, ((float64_t*)x_bytes)[i]); + } + float64_t r64[2]; + r64[0] = min_val64; + r64[1].v = 0x1; + r_data = u3i_bytes((8+1)*sizeof(c3_y), (c3_y*)r64); + break;} + + case 7: { + float128_t min_val128 = ((float128_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + min_val128 = *f128M_min(&min_val128, &((float128_t*)x_bytes)[i]); + } + float128_t r128[2]; + r128[0] = min_val128; + r128[1] = (float128_t){0x1, 0x0}; + r_data = u3i_bytes((16+1)*sizeof(c3_y), (c3_y*)r128); + break;} + } + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* max - max(x,y) +*/ + u3_noun + u3qi_la_max_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by for range) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + + u3_noun r_data; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: { + float16_t max_val16 = ((float16_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + max_val16 = f16_max(max_val16, ((float16_t*)x_bytes)[i]); + } + float16_t r16[2]; + r16[0] = max_val16; + r16[1].v = 0x1; + r_data = u3i_bytes((2+1)*sizeof(c3_y), (c3_y*)r16); + break;} + + case 5: { + float32_t max_val32 = ((float32_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + max_val32 = f32_max(max_val32, ((float32_t*)x_bytes)[i]); + } + float32_t r32[2]; + r32[0] = max_val32; + r32[1].v = 0x1; + r_data = u3i_bytes((4+1)*sizeof(c3_y), (c3_y*)r32); + break;} + + case 6: { + float64_t max_val64 = ((float64_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + max_val64 = f64_max(max_val64, ((float64_t*)x_bytes)[i]); + } + float64_t r64[2]; + r64[0] = max_val64; + r64[1].v = 0x1; + r_data = u3i_bytes((8+1)*sizeof(c3_y), (c3_y*)r64); + break;} + + case 7: { + float128_t max_val128 = ((float128_t*)x_bytes)[0]; + for (c3_d i = 0; i < len_x; i++) { + max_val128 = *f128M_max(&max_val128, &((float128_t*)x_bytes)[i]); + } + float128_t r128[2]; + r128[0] = max_val128; + r128[1] = (float128_t){0x1, 0x0}; + r_data = u3i_bytes((16+1)*sizeof(c3_y), (c3_y*)r128); + break;} + } + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* abs - |x| +*/ + u3_noun + u3qi_la_abs_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by for range) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + ((float16_t*)x_bytes)[i] = f16_abs(((float16_t*)x_bytes)[i]); + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + ((float32_t*)x_bytes)[i] = f32_abs(((float32_t*)x_bytes)[i]); + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + ((float64_t*)x_bytes)[i] = f64_abs(((float64_t*)x_bytes)[i]); + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + ((float128_t*)x_bytes)[i] = f128_abs(((float128_t*)x_bytes)[i]); + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), x_bytes); + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* gth - x > y +*/ + u3_noun + u3qi_la_gth_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + float16_t y_val16 = ((float16_t*)y_bytes)[i]; + ((float16_t*)y_bytes)[i] = f16_gt(x_val16, y_val16) ? (float16_t){SB_REAL16_ONE} : (float16_t){SB_REAL16_ZERO}; + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + float32_t y_val32 = ((float32_t*)y_bytes)[i]; + ((float32_t*)y_bytes)[i] = f32_gt(x_val32, y_val32) ? (float32_t){SB_REAL32_ONE} : (float32_t){SB_REAL32_ZERO}; + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + float64_t y_val64 = ((float64_t*)y_bytes)[i]; + ((float64_t*)y_bytes)[i] = f64_gt(x_val64, y_val64) ? (float64_t){SB_REAL64_ONE} : (float64_t){SB_REAL64_ZERO}; + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + float128_t y_val128 = ((float128_t*)y_bytes)[i]; + ((float128_t*)y_bytes)[i] = f128M_gt(((float128_t*)&x_val128), ((float128_t*)&y_val128)) ? (float128_t){SB_REAL128L_ONE, SB_REAL128U_ONE} : (float128_t){SB_REAL128L_ZERO, SB_REAL128U_ZERO}; + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* gte - x > y +*/ + u3_noun + u3qi_la_gte_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + float16_t y_val16 = ((float16_t*)y_bytes)[i]; + ((float16_t*)y_bytes)[i] = f16_ge(x_val16, y_val16) ? (float16_t){SB_REAL16_ONE} : (float16_t){SB_REAL16_ZERO}; + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + float32_t y_val32 = ((float32_t*)y_bytes)[i]; + ((float32_t*)y_bytes)[i] = f32_ge(x_val32, y_val32) ? (float32_t){SB_REAL32_ONE} : (float32_t){SB_REAL32_ZERO}; + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + float64_t y_val64 = ((float64_t*)y_bytes)[i]; + ((float64_t*)y_bytes)[i] = f64_ge(x_val64, y_val64) ? (float64_t){SB_REAL64_ONE} : (float64_t){SB_REAL64_ZERO}; + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + float128_t y_val128 = ((float128_t*)y_bytes)[i]; + ((float128_t*)y_bytes)[i] = f128M_ge(((float128_t*)&x_val128), ((float128_t*)&y_val128)) ? (float128_t){SB_REAL128L_ONE, SB_REAL128U_ONE} : (float128_t){SB_REAL128L_ZERO, SB_REAL128U_ZERO}; + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* lth - x > y +*/ + u3_noun + u3qi_la_lth_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + float16_t y_val16 = ((float16_t*)y_bytes)[i]; + ((float16_t*)y_bytes)[i] = f16_lt(x_val16, y_val16) ? (float16_t){SB_REAL16_ONE} : (float16_t){SB_REAL16_ZERO}; + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + float32_t y_val32 = ((float32_t*)y_bytes)[i]; + ((float32_t*)y_bytes)[i] = f32_lt(x_val32, y_val32) ? (float32_t){SB_REAL32_ONE} : (float32_t){SB_REAL32_ZERO}; + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + float64_t y_val64 = ((float64_t*)y_bytes)[i]; + ((float64_t*)y_bytes)[i] = f64_lt(x_val64, y_val64) ? (float64_t){SB_REAL64_ONE} : (float64_t){SB_REAL64_ZERO}; + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + float128_t y_val128 = ((float128_t*)y_bytes)[i]; + ((float128_t*)y_bytes)[i] = f128M_lt(((float128_t*)&x_val128), ((float128_t*)&y_val128)) ? (float128_t){SB_REAL128L_ONE, SB_REAL128U_ONE} : (float128_t){SB_REAL128L_ZERO, SB_REAL128U_ZERO}; + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* lte - x > y +*/ + u3_noun + u3qi_la_lte_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + float16_t y_val16 = ((float16_t*)y_bytes)[i]; + ((float16_t*)y_bytes)[i] = f16_le(x_val16, y_val16) ? (float16_t){SB_REAL16_ONE} : (float16_t){SB_REAL16_ZERO}; + } + break; + + case 5: + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + float32_t y_val32 = ((float32_t*)y_bytes)[i]; + ((float32_t*)y_bytes)[i] = f32_le(x_val32, y_val32) ? (float32_t){SB_REAL32_ONE} : (float32_t){SB_REAL32_ZERO}; + } + break; + + case 6: + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + float64_t y_val64 = ((float64_t*)y_bytes)[i]; + ((float64_t*)y_bytes)[i] = f64_le(x_val64, y_val64) ? (float64_t){SB_REAL64_ONE} : (float64_t){SB_REAL64_ZERO}; + } + break; + + case 7: + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + float128_t y_val128 = ((float128_t*)y_bytes)[i]; + ((float128_t*)y_bytes)[i] = f128M_le(((float128_t*)&x_val128), ((float128_t*)&y_val128)) ? (float128_t){SB_REAL128L_ONE, SB_REAL128U_ONE} : (float128_t){SB_REAL128L_ZERO, SB_REAL128U_ZERO}; + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* adds - axpy = 1*x+[n] +*/ + u3_noun + u3qi_la_adds_i754(u3_noun x_data, + u3_noun n, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + + float16_t n16; + float32_t n32; + float64_t n64; + float128_t n128; + + // Switch on the block size. We assume that n fits in the target block size; Hoon typecheck should prevent. + switch (u3x_atom(bloq)) { + case 4: + u3r_bytes(0, 2, (c3_y*)&(n16.v), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float16_t*)y_bytes)[i] = n16; + } + haxpy(len_x, (float16_t){SB_REAL16_ONE}, (float16_t*)x_bytes, 1, (float16_t*)y_bytes, 1); + break; + + case 5: + u3r_bytes(0, 4, (c3_y*)&(n32.v), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float32_t*)y_bytes)[i] = n32; + } + saxpy(len_x, (float32_t){SB_REAL32_ONE}, (float32_t*)x_bytes, 1, (float32_t*)y_bytes, 1); + break; + + case 6: + u3r_bytes(0, 8, (c3_y*)&(n64.v), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float64_t*)y_bytes)[i] = n64; + } + daxpy(len_x, (float64_t){SB_REAL64_ONE}, (float64_t*)x_bytes, 1, (float64_t*)y_bytes, 1); + break; + + case 7: + u3r_bytes(0, 16, (c3_y*)&(n128.v[0]), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float128_t*)y_bytes)[i] = (float128_t){n128.v[0], n128.v[1]}; + } + qaxpy(len_x, (float128_t){SB_REAL128L_ONE,SB_REAL128U_ONE}, (float128_t*)x_bytes, 1, (float128_t*)y_bytes, 1); + break; + } + + // r_data is the result noun of [data] + y_bytes[syz_x] = 0x1; // pin head + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* subs - axpy = -1*[n]+x +*/ + u3_noun + u3qi_la_subs_i754(u3_noun x_data, + u3_noun n, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/o leading 0x1) + c3_y* y_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + + float16_t n16; + float32_t n32; + float64_t n64; + float128_t n128; + + // Switch on the block size. We assume that n fits in the target block size; Hoon typecheck should prevent. + switch (u3x_atom(bloq)) { + case 4: + u3r_bytes(0, 2, (c3_y*)&(n16.v), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float16_t*)y_bytes)[i] = n16; + } + haxpy(len_x, (float16_t){SB_REAL16_NEGONE}, (float16_t*)y_bytes, 1, (float16_t*)x_bytes, 1); + break; + + case 5: + u3r_bytes(0, 4, (c3_y*)&(n32.v), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float32_t*)y_bytes)[i] = n32; + } + saxpy(len_x, (float32_t){SB_REAL32_NEGONE}, (float32_t*)y_bytes, 1, (float32_t*)x_bytes, 1); + break; + + case 6: + u3r_bytes(0, 8, (c3_y*)&(n64.v), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float64_t*)y_bytes)[i] = n64; + } + daxpy(len_x, (float64_t){SB_REAL64_NEGONE}, (float64_t*)y_bytes, 1, (float64_t*)x_bytes, 1); + break; + + case 7: + u3r_bytes(0, 16, (c3_y*)&(n128.v[0]), n); + // set y to [n] + for (c3_d i = 0; i < len_x; i++) { + ((float128_t*)y_bytes)[i] = (float128_t){n128.v[0], n128.v[1]}; + } + qaxpy(len_x, (float128_t){SB_REAL128L_NEGONE,SB_REAL128U_NEGONE}, (float128_t*)y_bytes, 1, (float128_t*)x_bytes, 1); + break; + } + + // r_data is the result noun of [data] + x_bytes[syz_x] = 0x1; // pin head + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), x_bytes); + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* muls - ?scal n * x + elementwise multiplication +*/ + u3_noun + u3qi_la_muls_i754(u3_noun x_data, + u3_noun n, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + x_bytes[syz_x] = 0x1; // pin head + + float16_t n16; + float32_t n32; + float64_t n64; + float128_t n128; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + u3r_bytes(0, 2, (c3_y*)&(n16.v), n); + hscal(len_x, n16, (float16_t*)x_bytes, 1); + break; + + case 5: + u3r_bytes(0, 4, (c3_y*)&(n32.v), n); + sscal(len_x, n32, (float32_t*)x_bytes, 1); + break; + + case 6: + u3r_bytes(0, 8, (c3_y*)&(n64.v), n); + dscal(len_x, n64, (float64_t*)x_bytes, 1); + break; + + case 7: + u3r_bytes(0, 16, (c3_y*)&(n128.v[0]), n); + qscal(len_x, n128, (float128_t*)x_bytes, 1); + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), x_bytes); + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* divs - ?scal 1/n * x + elementwise division +*/ + u3_noun + u3qi_la_divs_i754(u3_noun x_data, + u3_noun n, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + x_bytes[syz_x] = 0x1; // pin head + + float16_t in16; + float32_t in32; + float64_t in64; + float128_t in128; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + // XX note that in16 is doing double duty here + u3r_bytes(0, 2, (c3_y*)&(in16.v), n); + in16 = f16_div((float16_t){SB_REAL16_ONE}, in16); + hscal(len_x, in16, (float16_t*)x_bytes, 1); + break; + + case 5: + // XX note that in32 is doing double duty here + u3r_bytes(0, 4, (c3_y*)&(in32.v), n); + in32 = f32_div((float32_t){SB_REAL32_ONE}, in32); + sscal(len_x, in32, (float32_t*)x_bytes, 1); + break; + + case 6: + // XX note that in64 is doing double duty here + u3r_bytes(0, 8, (c3_y*)&(in64.v), n); + in64 = f64_div((float64_t){SB_REAL64_ONE}, in64); + dscal(len_x, in64, (float64_t*)x_bytes, 1); + break; + + case 7: + // XX note that in128 is doing double duty here + u3r_bytes(0, 16, (c3_y*)&(in128.v[0]), n); + f128M_div(&((float128_t){SB_REAL128L_ONE,SB_REAL128U_ONE}), &in128, &in128); + qscal(len_x, in128, (float128_t*)x_bytes, 1); + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), x_bytes); + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* mods - x % [n] = x - r*floor(x/r) + remainder after scalar division +*/ + u3_noun + u3qi_la_mods_i754(u3_noun x_data, + u3_noun n, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + // we reuse it for results for parsimony + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + + float16_t n16, in16; + float32_t n32, in32; + float64_t n64, in64; + float128_t n128, in128; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + u3r_bytes(0, 2, (c3_y*)&(n16.v), n); + in16 = f16_div((float16_t){SB_REAL16_ONE}, n16); + + for (c3_d i = 0; i < len_x; i++) { + float16_t x_val16 = ((float16_t*)x_bytes)[i]; + // Perform division x/n + float16_t div_result16 = f16_mul(in16, x_val16); + // Compute floor of the division result + c3_ds floor_result16 = f16_to_i64(div_result16, softfloat_round_minMag, false); + float16_t floor_float16 = i64_to_f16(floor_result16); + // Multiply n by floor(x/n) + float16_t mult_result16 = f16_mul(n16, floor_float16); + // Compute remainder: x - n * floor(x/n) + ((float16_t*)x_bytes)[i] = f16_sub(x_val16, mult_result16); + } + break; + + case 5: + u3r_bytes(0, 4, (c3_y*)&(n32.v), n); + in32 = f32_div((float32_t){SB_REAL32_ONE}, n32); + + for (c3_d i = 0; i < len_x; i++) { + float32_t x_val32 = ((float32_t*)x_bytes)[i]; + // Perform division x/n + float32_t div_result32 = f32_mul(in32, x_val32); + // Compute floor of the division result + c3_ds floor_result32 = f32_to_i64(div_result32, softfloat_round_minMag, false); + float32_t floor_float32 = i64_to_f32(floor_result32); + // Multiply n by floor(x/n) + float32_t mult_result32 = f32_mul(n32, floor_float32); + // Compute remainder: x - n * floor(x/n) + ((float32_t*)x_bytes)[i] = f32_sub(x_val32, mult_result32); + } + break; + + case 6: + u3r_bytes(0, 8, (c3_y*)&(n64.v), n); + in64 = f64_div((float64_t){SB_REAL64_ONE}, n64); + + for (c3_d i = 0; i < len_x; i++) { + float64_t x_val64 = ((float64_t*)x_bytes)[i]; + // Perform division x/n + float64_t div_result64 = f64_mul(in64, x_val64); + // Compute floor of the division result + c3_ds floor_result64 = f64_to_i64(div_result64, softfloat_round_minMag, false); + float64_t floor_float64 = i64_to_f64(floor_result64); + // Multiply n by floor(x/n) + float64_t mult_result64 = f64_mul(n64, floor_float64); + // Compute remainder: x - n * floor(x/n) + ((float64_t*)x_bytes)[i] = f64_sub(x_val64, mult_result64); + } + break; + + case 7: + u3r_bytes(0, 16, (c3_y*)&(n128.v[0]), n); + f128M_div(&((float128_t){SB_REAL128L_ONE,SB_REAL128U_ZERO}), &n128, &in128); + + for (c3_d i = 0; i < len_x; i++) { + float128_t x_val128 = ((float128_t*)x_bytes)[i]; + // Perform division x/n + float128_t div_result128; + f128M_mul((float128_t*)&in128, (float128_t*)&x_val128, (float128_t*)&div_result128); + // Compute floor of the division result + c3_ds floor_result128 = f128M_to_i64(&div_result128, softfloat_round_minMag, false); + float128_t floor_float128; + i64_to_f128M(floor_result128, &floor_float128); + // Multiply n by floor(x/n) + float128_t mult_result128; + f128M_mul(((float128_t*)&n128), ((float128_t*)&floor_float128), ((float128_t*)&mult_result128)); + // Compute remainder: x - n * floor(x/n) + f128M_sub(((float128_t*)&x_val128), ((float128_t*)&mult_result128), &(((float128_t*)x_bytes)[i])); + } + break; + } + + // r_data is the result noun of [data] + u3_noun r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), x_bytes); + + // Clean up and return. + u3a_free(x_bytes); + + return r_data; + } + +/* dot - ?dot = x · y +*/ + u3_noun + u3qi_la_dot_i754(u3_noun x_data, + u3_noun y_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(shape); + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // y_bytes is the data array (w/ leading 0x1, skipped by ?axpy) + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, y_bytes, y_data); + + u3_noun r_data; + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: { + float16_t r16[2]; + r16[0] = hdot(len_x, (float16_t*)x_bytes, 1, (float16_t*)y_bytes, 1); + r16[1].v = 0x1; + r_data = u3i_bytes((2+1)*sizeof(c3_y), (c3_y*)r16); + break;} + + case 5: { + float32_t r32[2]; + r32[0] = sdot(len_x, (float32_t*)x_bytes, 1, (float32_t*)y_bytes, 1); + r32[1].v = 0x1; + r_data = u3i_bytes((4+1)*sizeof(c3_y), (c3_y*)r32); + break;} + + case 6: { + float64_t r64[2]; + r64[0] = ddot(len_x, (float64_t*)x_bytes, 1, (float64_t*)y_bytes, 1); + r64[1].v = 0x1; + r_data = u3i_bytes((8+1)*sizeof(c3_y), (c3_y*)r64); + break;} + + case 7: { + float128_t r128[2]; + r128[0] = qdot(len_x, (float128_t*)x_bytes, 1, (float128_t*)y_bytes, 1); + r128[1] = (float128_t){0x1, 0x0}; + r_data = u3i_bytes((16+1)*sizeof(c3_y), (c3_y*)r128); + break;} + } + + // Clean up and return. + u3a_free(x_bytes); + u3a_free(y_bytes); + + return r_data; + } + +/* diag - diag(x) +*/ + u3_noun + u3qi_la_diag(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + // Assert length of dims is 2. + if (u3qb_lent(shape) != 2) { + return u3m_bail(c3__exit); + } + // Unpack shape into an array of dimensions. + c3_d *dims = _get_dims(shape); + if (dims[0] != dims[1]) { + return u3m_bail(c3__exit); + } + + // Unpack the data as a byte array. We assume total length < 2**64. + c3_d len_x = _get_length(shape); + c3_d syz_x = len_x * pow(2, bloq - 3); + c3_d wyd = pow(2, bloq - 3); + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + c3_d syz_y = wyd * dims[1]; + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_y+1)*sizeof(c3_y)); + + u3_noun r_data; + + // Grab the index at i*n_x+j in bytes; put it at j. + for (c3_d i = 0; i < dims[1]; i++) { + // Scan across whole field width. + for (c3_y k = 0; k < wyd; k++) { + y_bytes[i*wyd+k] = x_bytes[(i*dims[0]+i)*wyd+k]; + } + } + y_bytes[syz_y] = 0x1; // pin head + + // Unpack the result back into a noun. + r_data = u3i_bytes((syz_y+1)*sizeof(c3_y), y_bytes); + + u3a_free(x_bytes); + u3a_free(y_bytes); + u3a_free(dims); + + return r_data; + } + +/* transpose - x' +*/ + u3_noun + u3qi_la_transpose(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + // Assert length of dims is 2. + if (u3qb_lent(shape) != 2) { + return u3m_bail(c3__exit); + } + // Unpack shape into an array of dimensions. + c3_d *dims = _get_dims(shape); + + // Unpack the data as a byte array. We assume total length < 2**64. + c3_d len_x = _get_length(shape); + c3_d syz_x = len_x * pow(2, bloq - 3); + c3_d wyd = pow(2, bloq - 3); + c3_y* x_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + u3r_bytes(0, syz_x+1, x_bytes, x_data); + c3_y* y_bytes = (c3_y*)u3a_malloc((syz_x+1)*sizeof(c3_y)); + + u3_noun r_data; + + // Grab the index at i*n_x+j in bytes; put it at j. + for (c3_d i = 0; i < dims[1]; i++) { + for (c3_d j = 0; j < dims[0]; j++) { + // Scan across whole field width. + for (c3_y k = 0; k < wyd; k++) { + y_bytes[(j*dims[1]+i)*wyd+k] = x_bytes[(i*dims[0]+j)*wyd+k]; + } + } + } + y_bytes[syz_x] = 0x1; // pin head + + // Unpack the result back into a noun. + r_data = u3i_bytes((syz_x+1)*sizeof(c3_y), y_bytes); + + u3a_free(x_bytes); + u3a_free(y_bytes); + u3a_free(dims); + + return r_data; + } + +/* linspace - [a a+(b-a)/n ... b] +*/ + u3_noun + u3qi_la_linspace_i754(u3_noun a, + u3_noun b, + u3_noun n, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + u3_noun r_data; + + switch (u3x_atom(bloq)) { + case 4: { + float16_t a16, b16; + u3r_bytes(0, 2, (c3_y*)&(a16.v), a); + u3r_bytes(0, 2, (c3_y*)&(b16.v), b); + float16_t span16 = f16_sub(b16, a16); + float16_t interval16 = f16_div(span16, i32_to_f16(n-1)); + c3_y* x_bytes16 = (c3_y*)u3a_malloc((n*2+1)*sizeof(c3_y)); + for (c3_d i = 1; i < n-1; i++) { + ((float16_t*)x_bytes16)[i] = f16_add(a16, f16_mul(i32_to_f16(i), interval16)); + } + // Assign in reverse order so that n=1 case is correctly left-hand bound. + ((float16_t*)x_bytes16)[n-1] = b16; + ((float16_t*)x_bytes16)[0] = a16; + x_bytes16[n*2] = 0x1; // pin head + r_data = u3i_bytes((n*2+1)*sizeof(c3_y), x_bytes16); + u3a_free(x_bytes16); + break;} + + case 5: { + float32_t a32, b32; + u3r_bytes(0, 4, (c3_y*)&(a32.v), a); + u3r_bytes(0, 4, (c3_y*)&(b32.v), b); + float32_t span32 = f32_sub(b32, a32); + float32_t interval32 = f32_div(span32, i32_to_f32(n-1)); + c3_y* x_bytes32 = (c3_y*)u3a_malloc((n*4+1)*sizeof(c3_y)); + for (c3_d i = 1; i < n-1; i++) { + ((float32_t*)x_bytes32)[i] = f32_add(a32, f32_mul(i32_to_f32(i), interval32)); + } + ((float32_t*)x_bytes32)[n-1] = b32; + ((float32_t*)x_bytes32)[0] = a32; + x_bytes32[n*4] = 0x1; // pin head + r_data = u3i_bytes((n*4+1)*sizeof(c3_y), x_bytes32); + u3a_free(x_bytes32); + break;} + + case 6: { + float64_t a64, b64; + u3r_bytes(0, 8, (c3_y*)&(a64.v), a); + u3r_bytes(0, 8, (c3_y*)&(b64.v), b); + float64_t span64 = f64_sub(b64, a64); + float64_t interval64 = f64_div(span64, i32_to_f64(n-1)); + c3_y* x_bytes64 = (c3_y*)u3a_malloc((n*8+1)*sizeof(c3_y)); + for (c3_d i = 1; i < n-1; i++) { + ((float64_t*)x_bytes64)[i] = f64_add(a64, f64_mul(i32_to_f64(i), interval64)); + } + ((float64_t*)x_bytes64)[n-1] = b64; + ((float64_t*)x_bytes64)[0] = a64; + x_bytes64[n*8] = 0x1; // pin head + r_data = u3i_bytes((n*8+1)*sizeof(c3_y), x_bytes64); + u3a_free(x_bytes64); + break;} + + case 7: { + float128_t a128, b128; + u3r_bytes(0, 16, (c3_y*)&(a128.v[0]), a); + u3r_bytes(0, 16, (c3_y*)&(b128.v[0]), b); + float128_t span128; + f128M_sub(&b128, &a128, &span128); + float128_t interval128; + float128_t n128; + i32_to_f128M(n-1, &n128); + f128M_div(&span128, &n128, &interval128); + c3_y* x_bytes128 = (c3_y*)u3a_malloc((n*16+1)*sizeof(c3_y)); + float128_t i128; + for (c3_d i = 1; i < n-1; i++) { + i32_to_f128M(i, &i128); + f128M_mul(&i128, &interval128, &((float128_t*)x_bytes128)[i]); + f128M_add(&a128, &((float128_t*)x_bytes128)[i], &((float128_t*)x_bytes128)[i]); + } + ((float128_t*)x_bytes128)[n-1] = b128; + ((float128_t*)x_bytes128)[0] = a128; + x_bytes128[n*16] = 0x1; // pin head + r_data = u3i_bytes((n*16+1)*sizeof(c3_y), x_bytes128); + u3a_free(x_bytes128); + break;} + } + + return r_data; + } + +/* range - [a a+d ... b] +*/ + u3_noun + u3qi_la_range_i754(u3_noun a, + u3_noun b, + u3_noun d, + u3_noun bloq) + { + // Fence on valid bloq size. + if (bloq < 4 || bloq > 7) { + return u3_none; + } + + u3_noun r_data; + + switch (u3x_atom(bloq)) { + case 4: { + float16_t a16, b16, interval16; + u3r_bytes(0, 2, (c3_y*)&(a16.v), a); + u3r_bytes(0, 2, (c3_y*)&(b16.v), b); + u3r_bytes(0, 2, (c3_y*)&(interval16.v), d); + c3_d n16 = f16_to_i64(f16_ceil(f16_div(f16_sub(b16, a16), interval16)), softfloat_round_minMag, false); + c3_y* x_bytes16 = (c3_y*)u3a_malloc(((n16+1)*2)*sizeof(c3_y)); + ((float16_t*)x_bytes16)[0] = a16; + for (c3_d i = 1; i < n16; i++) { + ((float16_t*)x_bytes16)[i] = f16_add(a16, f16_mul(i32_to_f16(i), interval16)); + } + ((float16_t*)x_bytes16)[n16].v = 0x1; // pin head + r_data = u3i_bytes(((n16+1)*2)*sizeof(c3_y), x_bytes16); + u3a_free(x_bytes16); + break;} + + case 5: { + float32_t a32, b32, interval32; + u3r_bytes(0, 4, (c3_y*)&(a32.v), a); + u3r_bytes(0, 4, (c3_y*)&(b32.v), b); + u3r_bytes(0, 4, (c3_y*)&(interval32.v), d); + c3_d n32 = f32_to_i64(f32_ceil(f32_div(f32_sub(b32, a32), interval32)), softfloat_round_minMag, false); + c3_y* x_bytes32 = (c3_y*)u3a_malloc(((n32+1)*4)*sizeof(c3_y)); + ((float32_t*)x_bytes32)[0] = a32; + for (c3_d i = 1; i < n32; i++) { + ((float32_t*)x_bytes32)[i] = f32_add(a32, f32_mul(i32_to_f32(i), interval32)); + } + ((float32_t*)x_bytes32)[n32].v = 0x1; // pin head + r_data = u3i_bytes(((n32+1)*4)*sizeof(c3_y), x_bytes32); + u3a_free(x_bytes32); + break;} + + case 6: { + float64_t a64, b64, interval64; + u3r_bytes(0, 8, (c3_y*)&(a64.v), a); + u3r_bytes(0, 8, (c3_y*)&(b64.v), b); + u3r_bytes(0, 8, (c3_y*)&(interval64.v), d); + c3_d n64 = f64_to_i64(f64_ceil(f64_div(f64_sub(b64, a64), interval64)), softfloat_round_minMag, false); + c3_y* x_bytes64 = (c3_y*)u3a_malloc(((n64+1)*8)*sizeof(c3_y)); + ((float64_t*)x_bytes64)[0] = a64; + for (c3_d i = 1; i < n64; i++) { + ((float64_t*)x_bytes64)[i] = f64_add(a64, f64_mul(i32_to_f64(i), interval64)); + } + ((float64_t*)x_bytes64)[n64].v = 0x1; // pin head + r_data = u3i_bytes(((n64+1)*8)*sizeof(c3_y), x_bytes64); + u3a_free(x_bytes64); + break;} + + case 7: { + float128_t a128, b128, interval128; + u3r_bytes(0, 16, (c3_y*)&(a128.v[0]), a); + u3r_bytes(0, 16, (c3_y*)&(b128.v[0]), b); + u3r_bytes(0, 16, (c3_y*)&(interval128.v[0]), d); + float128_t tmp; + f128M_sub(&b128, &a128, &tmp); + f128M_div(&tmp, &interval128, &tmp); + f128M_ceil(&tmp, &tmp); + c3_d n128 = f128M_to_i64(&tmp, softfloat_round_minMag, false); + c3_y* x_bytes128 = (c3_y*)u3a_malloc(((n128+1)*16)*sizeof(c3_y)); + float128_t i128; + ((float128_t*)x_bytes128)[0] = a128; + for (c3_d i = 1; i < n128; i++) { + i32_to_f128M(i, &i128); + f128M_mul(&i128, &interval128, &((float128_t*)x_bytes128)[i]); + f128M_add(&a128, &((float128_t*)x_bytes128)[i], &((float128_t*)x_bytes128)[i]); + } + ((float128_t*)x_bytes128)[n128].v[0] = 0x1; // pin head + ((float128_t*)x_bytes128)[n128].v[1] = 0x0; // pin head + r_data = u3i_bytes(((n128+1)*16)*sizeof(c3_y), x_bytes128); + u3a_free(x_bytes128); + break;} + } + + return r_data; + } + +/* trace - tr(x) +*/ + u3_noun + u3qi_la_trace_i754(u3_noun x_data, + u3_noun shape, + u3_noun bloq) + { + u3_noun d_data = u3qi_la_diag(x_data, shape, bloq); + c3_d len_x0 = _get_dims(shape)[0]; + u3_noun r_data = u3qi_la_dot_i754(d_data, d_data, u3nt(len_x0, 0x1, u3_nul), u3k(bloq)); + return r_data; + } + +/* mmul +*/ + u3_noun + u3qi_la_mmul_i754(u3_noun x_data, + u3_noun y_data, + u3_noun x_shape, + u3_noun y_shape, + u3_noun bloq) + { + // Unpack the data as a byte array. We assume total length < 2**64. + c3_d M = u3x_atom(u3h(x_shape)); + c3_d Na= u3x_atom(u3h(u3t(x_shape))); + c3_d Nb= u3x_atom(u3h(y_shape)); + c3_d P = u3x_atom(u3h(u3t(y_shape))); + + if ((u3_nul != u3t(u3t(x_shape))) || + (u3_nul != u3t(u3t(y_shape))) || + (Na != Nb)) { + return u3m_bail(c3__exit); + } + c3_d N = Na; + + // Unpack the data as a byte array. We assume total length < 2**64. + // len_x is length in base units + c3_d len_x = _get_length(x_shape); // M*N + + // syz_x is length in bytes + c3_d syz_x = len_x * pow(2, bloq-3); // M*N + + // x_bytes is the data array (w/o leading 0x1) + c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); + u3r_bytes(0, syz_x, x_bytes, x_data); + + // len_x is length in base units + c3_d len_y = _get_length(y_shape); // N*P + + // syz_x is length in bytes + c3_d syz_y = len_y * pow(2, bloq-3); // N*P + + // y_bytes is the data array (w/o leading 0x1) + c3_y* y_bytes = (c3_y*)u3a_malloc(syz_y*sizeof(c3_y)); + u3r_bytes(0, syz_y, y_bytes, y_data); + + // len_r is length in base units + c3_d len_r = M*P; // M*P + + // syz_r is length in bytes + c3_d syz_r = len_r * pow(2, bloq-3); // M*P + + // r_bytes is the result array + c3_y* r_bytes = (c3_y*)u3a_malloc((syz_r+1)*sizeof(c3_y)); + r_bytes[syz_r] = 0x1; // pin head + // initialize with 0x0s + for (c3_d i = 0; i < syz_r; i++) { + r_bytes[i] = 0x0; + } + + // Switch on the block size. + switch (u3x_atom(bloq)) { + case 4: + hgemm('N', 'N', M, N, P, (float16_t){SB_REAL16_ONE}, (float16_t*)x_bytes, N, (float16_t*)y_bytes, P, (float16_t){SB_REAL16_ZERO}, (float16_t*)r_bytes, P); + break; + + case 5: + sgemm('N', 'N', M, N, P, (float32_t){SB_REAL32_ONE}, (float32_t*)x_bytes, N, (float32_t*)y_bytes, P, (float32_t){SB_REAL32_ZERO}, (float32_t*)r_bytes, P); + break; + + case 6: + dgemm('N', 'N', M, N, P, (float64_t){SB_REAL64_ONE}, (float64_t*)x_bytes, N, (float64_t*)y_bytes, P, (float64_t){SB_REAL64_ZERO}, (float64_t*)r_bytes, P); + break; + + case 7: + qgemm('N', 'N', M, N, P, (float128_t){SB_REAL128L_ONE,SB_REAL128U_ONE}, (float128_t*)x_bytes, N, (float128_t*)y_bytes, P, (float128_t){SB_REAL128L_ZERO,SB_REAL128U_ZERO}, (float128_t*)r_bytes, P); + break; + } + + // Unpack the result back into a noun. + u3_noun r_data = u3i_bytes(syz_r+1, r_bytes); + u3_noun M_ = u3i_chub(M); + u3_noun P_ = u3i_chub(P); + + u3a_free(x_bytes); + u3a_free(y_bytes); + u3a_free(r_bytes); + + return u3nc(u3nq(u3nt(M_, P_, u3_nul), u3k(bloq), c3__i754, u3_nul), r_data); + } + + u3_noun + u3wi_la_add(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == u3ud(rnd) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_add_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_sub(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == u3ud(rnd) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_sub_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_mul(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == u3ud(rnd) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_mul_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_div(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == u3ud(rnd) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_div_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_mod(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == u3ud(rnd) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_mod_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_cumsum(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(u3nc(x_meta, x_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_cumsum_i754(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3nc(0x1, u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_argmin(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(u3nc(x_meta, x_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_argmin_i754(x_data, x_shape, x_bloq); + // bare atom (@ index) + return r_data;} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_ravel(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(u3nc(x_meta, x_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_ravel_i754(x_data, x_shape, x_bloq); + // (list @) + return r_data;} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_argmax(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(u3nc(x_meta, x_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_argmax_i754(x_data, x_shape, x_bloq); + // bare atom (@ index) + return r_data;} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_min(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(u3nc(x_meta, x_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_min_i754(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3nt(0x1, 0x1, u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_max(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(u3nc(x_meta, x_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_max_i754(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3nt(0x1, 0x1, u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_abs(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_abs_i754(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_gth(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_gth_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3k(x_meta), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_gte(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_gte_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3k(x_meta), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_lth(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_lth_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3k(x_meta), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_lte(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_lte_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3k(x_meta), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_adds(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, n; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_3, &n, + 0) || + c3n == u3ud(x_data) || + c3n == u3ud(n) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_adds_i754(x_data, n, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + + u3_noun + u3wi_la_subs(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, n; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_3, &n, + 0) || + c3n == u3ud(x_data) || + c3n == u3ud(n) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_subs_i754(x_data, n, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + + u3_noun + u3wi_la_muls(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, n; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_3, &n, + 0) || + c3n == u3ud(x_data) || + c3n == u3ud(n) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_muls_i754(x_data, n, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + + u3_noun + u3wi_la_divs(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, n; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_3, &n, + 0) || + c3n == u3ud(x_data) || + c3n == u3ud(n) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_divs_i754(x_data, n, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + + u3_noun + u3wi_la_mods(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, n; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_3, &n, + 0) || + c3n == u3ud(x_data) || + c3n == u3ud(n) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_mods_i754(x_data, n, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + + u3_noun + u3wi_la_dot(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3r_sing(x_meta, y_meta) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_dot_i754(x_data, y_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + c3_d len_x0 = _get_dims(x_shape)[0]; + return u3nc(u3nq(u3nt(len_x0, 0x1, u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_transpose(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(cor) + ) + { + return u3m_bail(c3__exit); + } else { + u3_noun r_data = u3qi_la_transpose(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3nt(u3k(u3h(x_shape)), u3k(u3h(u3t(x_shape))), u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + } + } + } + + u3_noun + u3wi_la_linspace(u3_noun cor) + { + u3_noun x_meta, a, b, n, rnd; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_12, &a, + u3x_sam_13, &b, + u3x_sam_7, &n, + 0)) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == u3ud(n) || + (n < 1) // crash on zero size + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_linspace_i754(a, b, n, x_bloq); + if (r_data == u3_none) { return u3_none; } + x_shape = u3nc(u3x_atom(n), u3_nul); + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_range(u3_noun cor) + { + u3_noun x_meta, a, b, d, rnd; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_12, &a, + u3x_sam_13, &b, + u3x_sam_7, &d, + 0)) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_range_i754(a, b, d, x_bloq); + if (r_data == u3_none) { return u3_none; } + c3_d a_, b_, d_; + c3_ds n_; + switch (x_bloq) { + case 4: + u3r_bytes(0, 2, (c3_y*)&a_, a); + u3r_bytes(0, 2, (c3_y*)&b_, b); + u3r_bytes(0, 2, (c3_y*)&d_, d); + n_ = f16_to_i64(f16_ceil(f16_div(f16_sub((float16_t){b_}, (float16_t){a_}), (float16_t){d_})), softfloat_round_minMag, false) - 1; + break; + case 5: + u3r_bytes(0, 4, (c3_y*)&a_, a); + u3r_bytes(0, 4, (c3_y*)&b_, b); + u3r_bytes(0, 4, (c3_y*)&d_, d); + n_ = f32_to_i64(f32_ceil(f32_div(f32_sub((float32_t){b_}, (float32_t){a_}), (float32_t){d_})), softfloat_round_minMag, false) - 1; + break; + case 6: + u3r_bytes(0, 8, (c3_y*)&a_, a); + u3r_bytes(0, 8, (c3_y*)&b_, b); + u3r_bytes(0, 8, (c3_y*)&d_, d); + n_ = f64_to_i64(f64_ceil(f64_div(f64_sub((float64_t){b_}, (float64_t){a_}), (float64_t){d_})), softfloat_round_minMag, false) - 1; + break; + case 7: { + c3_d a__[2], b__[2], d__[2]; + u3r_bytes(0, 16, (c3_y*)&a__, a); + u3r_bytes(0, 16, (c3_y*)&b__, b); + u3r_bytes(0, 16, (c3_y*)&d__, d); + float128_t tmp; + f128M_sub((float128_t*)&b__, (float128_t*)&a__, &tmp); + f128M_div(&tmp, (float128_t*)&d__, &tmp); + f128M_ceil(&tmp, &tmp); + n_ = f128M_to_i64(&tmp, softfloat_round_minMag, false) - 1; + break;} + } + u3_noun n = u3i_chub(n_+1); + x_shape = u3nc(u3k(n), u3_nul); + return u3nc(u3nq(u3k(x_shape), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_diag(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + x_tail = u3t(u3t(u3t(x_meta))); // 15 + if ( c3n == u3ud(x_bloq) || + c3n == u3ud(x_kind) || + c3n == _check(cor) + ) + { + return u3m_bail(c3__exit); + } else { + u3_noun r_data = u3qi_la_diag(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + c3_d len_x0 = _get_dims(x_shape)[0]; + return u3nc(u3nq(u3nt(len_x0, 0x1, u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data); + } + } + } + + u3_noun + u3wi_la_trace(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_2, &x_meta, + u3x_sam_3, &x_data, + 0) || + c3n == u3ud(x_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, x_tail; + if ( c3n == u3r_mean(x_meta, + 2, &x_shape, + 6, &x_bloq, + 14, &x_kind, + 15, &x_tail, + 0) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: { + u3_noun r_data = u3qi_la_trace_i754(x_data, x_shape, x_bloq); + if (r_data == u3_none) { return u3_none; } + return u3nc(u3nq(u3nt(0x1, 0x1, u3_nul), u3k(x_bloq), u3k(x_kind), u3k(x_tail)), r_data);} + + default: + return u3_none; + } + } + } + } + + u3_noun + u3wi_la_mmul(u3_noun cor) + { + // Each argument is a ray, [=meta data=@ux] + u3_noun x_meta, x_data, + y_meta, y_data; + + if ( c3n == u3r_mean(cor, + u3x_sam_4, &x_meta, + u3x_sam_5, &x_data, + u3x_sam_6, &y_meta, + u3x_sam_7, &y_data, + 0) || + c3n == u3ud(x_data) || + c3n == u3ud(y_data) ) + { + return u3m_bail(c3__exit); + } else { + u3_noun x_shape, x_bloq, x_kind, + y_shape, + rnd; + x_shape = u3h(x_meta); // 2 + x_bloq = u3h(u3t(x_meta)); // 6 + x_kind = u3h(u3t(u3t(x_meta))); // 14 + y_shape = u3h(y_meta); // 2 + rnd = u3h(u3t(u3t(u3t(cor)))); // 30 + if ( c3n == _check(u3nc(x_meta, x_data)) || + c3n == _check(u3nc(y_meta, y_data)) + ) + { + return u3m_bail(c3__exit); + } else { + switch (x_kind) { + case c3__i754: + _set_rounding(rnd); + u3_noun r_data = u3qi_la_mmul_i754(x_data, y_data, x_shape, y_shape, x_bloq); + // result is already [meta data] + return r_data; + + default: + return u3_none; + } + } + } + } diff --git a/vere/pkg/noun/jets/k.h b/vere/pkg/noun/jets/k.h new file mode 100644 index 0000000..27733fb --- /dev/null +++ b/vere/pkg/noun/jets/k.h @@ -0,0 +1,185 @@ +/// @file + +#ifndef U3_JETS_K_H +#define U3_JETS_K_H + +#include "types.h" + + /** Tier 1. + **/ + u3_noun u3ka_add(u3_noun a, u3_noun b); + u3_noun u3ka_dec(u3_atom a); + u3_noun u3ka_div(u3_noun a, u3_noun b); + u3_noun u3ka_sub(u3_noun a, u3_noun b); + u3_noun u3ka_max(u3_noun a, u3_noun b); + u3_noun u3ka_min(u3_noun a, u3_noun b); + u3_noun u3ka_mod(u3_noun a, u3_noun b); + u3_noun u3ka_mul(u3_noun a, u3_noun b); + u3_noun u3ka_gth(u3_noun a, u3_noun b); + u3_noun u3ka_lte(u3_noun a, u3_noun b); + + /** Tier 2. + **/ + u3_noun u3kb_lent(u3_noun a); + u3_noun u3kb_weld(u3_noun a, u3_noun b); + u3_noun u3kb_flop(u3_noun a); + +/* u3kc: tier 3 functions +*/ + /* u3kc_bex(): binary exponent. + */ + u3_noun + u3kc_bex(u3_atom); + + /* u3kc_con(): binary loobean conjunction. + */ + u3_noun + u3kc_con(u3_noun a, + u3_noun b); + + /* u3kc_mix(): binary xor. + */ + u3_noun + u3kc_mix(u3_atom a, u3_atom b); + + /* u3kc_lsh(): left shift. + */ + u3_noun + u3kc_lsh(u3_noun a, u3_noun b, u3_noun c); + + /* u3kc_rsh(): right shift. + */ + u3_noun + u3kc_rsh(u3_noun a, u3_noun b, u3_noun c); + + /* u3kc_rep(): assemble single. + */ + u3_noun + u3kc_rep(u3_atom a, + u3_atom b, + u3_noun c); + + /* u3kc_rip(): disassemble. + */ + u3_noun + u3kc_rip(u3_atom a, + u3_atom b, + u3_atom c); + + /* u3kc_rev(): reverse block order, accounting for leading zeroes. + */ + u3_noun + u3kc_rev(u3_atom boz, u3_atom len, u3_atom dat); + + /* u3kc_swp(): reverse block order. + */ + u3_noun + u3kc_swp(u3_atom a, u3_atom b); + +/* u3kd: tier 4 functions +*/ + /* u3kdb_get(): map get for key `b` in map `a` with u3_none. + */ + u3_weak + u3kdb_get(u3_noun a, u3_noun b); + + /* u3kdb_got(): map get for key `b` in map `a` with bail. + */ + u3_noun + u3kdb_got(u3_noun a, u3_noun b); + + /* u3kdb_put(): map put for key `b`, value `c` in map `a`. + */ + u3_weak + u3kdb_put(u3_noun a, u3_noun b, u3_noun c); + + /* u3kdb_del(): map del for key `b` + */ + u3_weak + u3kdb_del(u3_noun a, u3_noun b); + + /* u3kdb_has(): test for get. + */ + u3_noun + u3kdb_has(u3_noun a, u3_noun b); + + /* u3kdb_gas(): list to map. + */ + u3_noun + u3kdb_gas(u3_noun a, u3_noun b); + + /* u3kdb_uni(): map union. + */ + u3_noun + u3kdb_uni(u3_noun a, u3_noun b); + + /* u3kdi_gas(): list to map. + */ + u3_noun + u3kdi_gas(u3_noun a, u3_noun b); + + /* u3kdi_has(): test for presence. + */ + u3_noun + u3kdi_has(u3_noun a, u3_noun b); + + /* u3kdi_tap(): map/set convert to list. (solves by_tap also.) + */ + u3_noun + u3kdi_tap(u3_noun a); + + /* u3kdi_put(): put in set. + */ + u3_weak + u3kdi_put(u3_noun a, u3_noun b); + + /* u3kdi_uni(): set union. + */ + u3_noun + u3kdi_uni(u3_noun a, u3_noun b); + +# define u3kdb_tap(a) u3kdi_tap(a) + +/* u3ke: tier 5 functions +*/ + /* u3ke_cue(): expand saved pill. + */ + u3_noun + u3ke_cue(u3_atom a); + + /* u3ke_jam(): pack noun as atom. + */ + u3_atom + u3ke_jam(u3_noun a); + + /* u3ke_trip(): atom to tape. + */ + u3_noun + u3ke_trip(u3_noun a); + + /* u3ke_json_de(): parse JSON from cord. + */ + u3_noun + u3ke_json_de(u3_atom); + + /* u3ke_json_en(): serialize JSON to cord. + */ + u3_atom + u3ke_json_en(u3_noun); + + /* u3kf_fork(): build %fork span. + */ + u3_noun + u3kf_fork(u3_noun yed); + + /* u3kz_fork(): build %fork span. + */ + u3_noun + u3kz_fork(u3_noun yed); + + /* u3kfu_repo(): + */ + u3_noun + u3kfu_repo(u3_noun, u3_noun); + +#endif /* ifndef U3_JETS_K_H */ diff --git a/vere/pkg/noun/jets/q.h b/vere/pkg/noun/jets/q.h new file mode 100644 index 0000000..db1cfe1 --- /dev/null +++ b/vere/pkg/noun/jets/q.h @@ -0,0 +1,306 @@ +/// @file + +#ifndef U3_JETS_Q_H +#define U3_JETS_Q_H + +#include "types.h" + + /** Tier 1. + **/ + u3_noun u3qa_add(u3_atom, u3_atom); + u3_noun u3qa_dec(u3_atom); + u3_noun u3qa_div(u3_atom, u3_atom); + u3_noun u3qa_gte(u3_atom, u3_atom); + u3_noun u3qa_gth(u3_atom, u3_atom); + u3_noun u3qa_inc(u3_atom); + u3_noun u3qa_lte(u3_atom, u3_atom); + u3_noun u3qa_lth(u3_atom, u3_atom); + u3_noun u3qa_max(u3_atom, u3_atom); + u3_noun u3qa_min(u3_atom, u3_atom); + u3_noun u3qa_mod(u3_atom, u3_atom); + u3_noun u3qa_mul(u3_atom, u3_atom); + u3_noun u3qa_sub(u3_atom, u3_atom); + + /** Tier 2. + **/ + u3_noun u3qb_bind(u3_noun, u3_noun); + u3_noun u3qb_clap(u3_noun, u3_noun, u3_noun); + u3_noun u3qb_drop(u3_noun); + u3_noun u3qb_flop(u3_noun); + u3_noun u3qb_lent(u3_noun); + u3_noun u3qb_levy(u3_noun, u3_noun); + u3_noun u3qb_lien(u3_noun, u3_noun); + u3_noun u3qb_murn(u3_noun, u3_noun); + u3_noun u3qb_need(u3_noun); + u3_noun u3qb_mate(u3_noun, u3_noun); + u3_noun u3qb_reap(u3_atom, u3_noun); + u3_noun u3qb_reel(u3_noun, u3_noun); + u3_noun u3qb_roll(u3_noun, u3_noun); + u3_noun u3qb_skid(u3_noun, u3_noun); + u3_noun u3qb_skim(u3_noun, u3_noun); + u3_noun u3qb_skip(u3_noun, u3_noun); + u3_noun u3qb_scag(u3_atom, u3_noun); + u3_noun u3qb_slag(u3_atom, u3_noun); + u3_noun u3qb_snag(u3_atom, u3_noun); + u3_noun u3qb_sort(u3_noun, u3_noun); + u3_noun u3qb_turn(u3_noun, u3_noun); + u3_noun u3qb_weld(u3_noun, u3_noun); + + /** Tier 3. + **/ + u3_noun u3qc_aor(u3_atom, u3_atom); + u3_noun u3qc_bex(u3_atom); + u3_noun u3qc_xeb(u3_atom); + u3_noun u3qc_can(u3_atom, u3_noun); + u3_noun u3qc_cap(u3_atom); + u3_noun u3qc_cat(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_clz(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_con(u3_atom, u3_atom); + u3_noun u3qc_ctz(u3_atom); + u3_noun u3qc_cut(u3_atom, u3_atom, u3_atom, u3_atom); + u3_noun u3qc_dis(u3_atom, u3_atom); + u3_noun u3qc_dor(u3_atom, u3_atom); + u3_noun u3qc_dvr(u3_atom, u3_atom); + u3_noun u3qc_end(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_gor(u3_atom, u3_atom); + u3_noun u3qc_ham(u3_atom); + u3_noun u3qc_hew(u3_atom, u3_atom, u3_atom, u3_noun); + u3_noun u3qc_lsh(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_mas(u3_atom); + u3_noun u3qc_met(u3_atom, u3_atom); + u3_noun u3qc_mix(u3_atom, u3_atom); + u3_noun u3qc_mor(u3_atom, u3_atom); + u3_noun u3qc_muk(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_peg(u3_atom, u3_atom); + u3_noun u3qc_pow(u3_atom, u3_atom); + u3_noun u3qc_rap(u3_atom, u3_noun); + u3_noun u3qc_rep(u3_atom, u3_atom, u3_noun); + u3_noun u3qc_rev(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_rig(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_rip(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_rsh(u3_atom, u3_atom, u3_atom); + u3_noun u3qc_sew(u3_atom, u3_atom, u3_atom, u3_atom, u3_atom); + u3_noun u3qc_swp(u3_atom, u3_atom); + u3_noun u3qc_sqt(u3_atom); + + c3_d u3qc_rig_s(c3_g, c3_w, c3_g); + + u3_noun u3_po_find_prefix(c3_y one, c3_y two, c3_y three); + u3_noun u3_po_find_suffix(c3_y one, c3_y two, c3_y three); + void u3_po_to_prefix(u3_noun id, c3_y* a, c3_y* b, c3_y* c); + void u3_po_to_suffix(u3_noun id, c3_y* a, c3_y* b, c3_y* c); + + /** Tier 4. + **/ + u3_noun u3qdb_all(u3_noun, u3_noun); + u3_noun u3qdb_any(u3_noun, u3_noun); + u3_noun u3qdb_apt(u3_noun); + u3_noun u3qdb_bif(u3_noun, u3_noun); + u3_noun u3qdb_del(u3_noun, u3_noun); + u3_noun u3qdb_dif(u3_noun, u3_noun); + u3_noun u3qdb_gas(u3_noun, u3_noun); + u3_noun u3qdb_get(u3_noun, u3_noun); + u3_noun u3qdb_has(u3_noun, u3_noun); + u3_noun u3qdb_int(u3_noun, u3_noun); + u3_noun u3qdb_key(u3_noun); + u3_noun u3qdb_put(u3_noun, u3_noun, u3_noun); + u3_noun u3qdb_run(u3_noun, u3_noun); +# define u3qdb_tap u3qdi_tap + u3_noun u3qdb_uni(u3_noun, u3_noun); + u3_noun u3qdb_urn(u3_noun, u3_noun); +# define u3qdb_wyt u3qdi_wyt + + u3_noun u3qdi_apt(u3_noun); + u3_noun u3qdi_bif(u3_noun, u3_noun); + u3_noun u3qdi_del(u3_noun, u3_noun); + u3_noun u3qdi_dif(u3_noun, u3_noun); + u3_noun u3qdi_gas(u3_noun, u3_noun); + u3_noun u3qdi_has(u3_noun, u3_noun); + u3_noun u3qdi_int(u3_noun, u3_noun); + u3_noun u3qdi_put(u3_noun, u3_noun); + u3_noun u3qdi_rep(u3_noun, u3_noun); + u3_noun u3qdi_run(u3_noun, u3_noun); + u3_noun u3qdi_tap(u3_noun); + u3_noun u3qdi_uni(u3_noun, u3_noun); + u3_noun u3qdi_wyt(u3_noun); + + /** Tier 5. + **/ + u3_noun u3qe_cue(u3_atom); + u3_noun u3qe_jam(u3_atom); + u3_noun u3qe_mat(u3_atom); + u3_noun u3qe_rub(u3_atom, u3_atom); + u3_noun u3qe_leer(u3_atom); + u3_noun u3qe_lore(u3_atom); + u3_noun u3qe_loss(u3_noun, u3_noun); + u3_noun u3qe_lune(u3_atom); + u3_noun u3qe_repg(u3_noun, u3_noun, u3_noun); + u3_noun u3qe_rexp(u3_noun, u3_noun); + u3_noun u3qe_trip(u3_atom); + + u3_atom u3qe_scot(u3_atom, u3_atom); + u3_atom u3qe_scow(u3_atom, u3_atom); + + u3_noun u3qea_ecba_en(u3_atom, u3_atom); + u3_noun u3qea_ecba_de(u3_atom, u3_atom); + u3_noun u3qea_ecbb_en(u3_atom, u3_atom); + u3_noun u3qea_ecbb_de(u3_atom, u3_atom); + u3_noun u3qea_ecbc_en(u3_atom, u3_atom); + u3_noun u3qea_ecbc_de(u3_atom, u3_atom); + + u3_noun u3qea_cbca_en(u3_atom, u3_atom, u3_atom); + u3_noun u3qea_cbca_de(u3_atom, u3_atom, u3_atom); + u3_noun u3qea_cbcb_en(u3_atom, u3_atom, u3_atom); + u3_noun u3qea_cbcb_de(u3_atom, u3_atom, u3_atom); + u3_noun u3qea_cbcc_en(u3_atom, u3_atom, u3_atom); + u3_noun u3qea_cbcc_de(u3_atom, u3_atom, u3_atom); + + u3_noun u3qea_de(u3_atom, u3_atom); + u3_noun u3qea_en(u3_atom, u3_atom); + + u3_noun u3qee_recs(u3_atom); + + u3_atom u3qe_fein_ob(u3_atom pyn); + u3_atom u3qe_fynd_ob(u3_atom pyn); + + u3_noun u3qe_hmac(u3_noun, u3_atom, u3_atom, + u3_atom, u3_atom, u3_atom, u3_atom); + + u3_noun u3qe_en_base16(u3_atom len, u3_atom dat); + u3_noun u3qe_de_base16(u3_atom inp); + + u3_noun u3qe_json_de(u3_atom); + u3_atom u3qe_json_en(u3_noun); + + u3_noun u3qeo_raw(u3_atom, u3_atom); + + u3_noun u3qef_drg(u3_noun, u3_atom); + u3_noun u3qef_lug(u3_noun, u3_noun, u3_atom, u3_atom); + + u3_noun u3qer_add(u3_atom, u3_atom, u3_atom); + u3_noun u3qer_sub(u3_atom, u3_atom, u3_atom); + u3_noun u3qer_mul(u3_atom, u3_atom, u3_atom); + u3_noun u3qer_div(u3_atom, u3_atom, u3_atom); + u3_noun u3qer_sqt(u3_atom, u3_atom); + u3_noun u3qer_fma(u3_atom, u3_atom, u3_atom, u3_atom); + u3_noun u3qer_lth(u3_atom, u3_atom); + u3_noun u3qer_lte(u3_atom, u3_atom); + u3_noun u3qer_equ(u3_atom, u3_atom); + u3_noun u3qer_gte(u3_atom, u3_atom); + u3_noun u3qer_gth(u3_atom, u3_atom); + + u3_noun u3qet_add(u3_atom, u3_atom, u3_atom); + u3_noun u3qet_sub(u3_atom, u3_atom, u3_atom); + u3_noun u3qet_mul(u3_atom, u3_atom, u3_atom); + u3_noun u3qet_div(u3_atom, u3_atom, u3_atom); + u3_noun u3qet_sqt(u3_atom, u3_atom); + u3_noun u3qet_fma(u3_atom, u3_atom, u3_atom, u3_atom); + u3_noun u3qet_lth(u3_atom, u3_atom); + u3_noun u3qet_lte(u3_atom, u3_atom); + u3_noun u3qet_equ(u3_atom, u3_atom); + u3_noun u3qet_gte(u3_atom, u3_atom); + u3_noun u3qet_gth(u3_atom, u3_atom); + + u3_noun u3qeq_add(u3_atom, u3_atom, u3_atom); + u3_noun u3qeq_sub(u3_atom, u3_atom, u3_atom); + u3_noun u3qeq_mul(u3_atom, u3_atom, u3_atom); + u3_noun u3qeq_div(u3_atom, u3_atom, u3_atom); + u3_noun u3qeq_sqt(u3_atom, u3_atom); + u3_noun u3qeq_fma(u3_atom, u3_atom, u3_atom, u3_atom); + u3_noun u3qeq_lth(u3_atom, u3_atom); + u3_noun u3qeq_lte(u3_atom, u3_atom); + u3_noun u3qeq_equ(u3_atom, u3_atom); + u3_noun u3qeq_gte(u3_atom, u3_atom); + u3_noun u3qeq_gth(u3_atom, u3_atom); + + u3_noun u3qes_add(u3_atom, u3_atom, u3_atom); + u3_noun u3qes_sub(u3_atom, u3_atom, u3_atom); + u3_noun u3qes_mul(u3_atom, u3_atom, u3_atom); + u3_noun u3qes_div(u3_atom, u3_atom, u3_atom); + u3_noun u3qes_sqt(u3_atom, u3_atom); + u3_noun u3qes_fma(u3_atom, u3_atom, u3_atom, u3_atom); + u3_noun u3qes_lth(u3_atom, u3_atom); + u3_noun u3qes_lte(u3_atom, u3_atom); + u3_noun u3qes_equ(u3_atom, u3_atom); + u3_noun u3qes_gte(u3_atom, u3_atom); + u3_noun u3qes_gth(u3_atom, u3_atom); + + u3_noun u3qe_decompress_zlib(u3_atom, u3_noun); + u3_noun u3qe_decompress_gzip(u3_atom, u3_noun); + + /** Tier 6. + **/ + u3_noun u3qf_bull(u3_noun, u3_noun); + u3_noun u3qf_cell(u3_noun, u3_noun); + u3_noun u3qf_comb(u3_noun, u3_noun); + u3_noun u3qf_cons(u3_noun, u3_noun); + u3_noun u3qf_core(u3_noun, u3_noun); + u3_noun u3qf_cube(u3_noun, u3_noun); + u3_noun u3qf_face(u3_noun, u3_noun); + u3_noun u3qf_fine(u3_noun, u3_noun, u3_noun); + u3_noun u3qf_fitz(u3_noun, u3_noun); + u3_noun u3qf_flay(u3_noun); + u3_noun u3qf_forq(u3_noun, u3_noun); + u3_noun u3qf_fork(u3_noun); + u3_noun u3qf_grof(u3_noun); + u3_noun u3qf_hint(u3_noun, u3_noun); + u3_noun u3qf_hike(u3_noun, u3_noun); + u3_noun u3qf_look(u3_noun, u3_noun); + u3_noun u3qf_loot(u3_noun, u3_noun); + u3_noun u3qf_slot(u3_atom, u3_noun); + u3_noun u3qf_type(u3_noun); + + u3_noun u3qfl_bunt(u3_noun, u3_noun); + u3_noun u3qfl_whip(u3_noun, u3_noun, u3_noun); + + u3_noun u3qfr_fish(u3_noun, u3_noun, u3_noun, u3_noun); + + u3_noun u3qfp_hack(u3_noun, u3_noun); + u3_noun u3qfp_late(u3_noun); + u3_noun u3qfp_open(u3_noun, u3_noun, u3_noun); + u3_noun u3qfp_nepo(u3_noun, u3_noun); + u3_noun u3qfp_rake(u3_noun); + + u3_noun u3qi_la_add_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_sub_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_mul_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_div_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_mod_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_adds_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_subs_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_muls_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_divs_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_mods_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_dot_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_diag(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_transpose(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_cumsum_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_argmin_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_argmax_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_ravel_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_min_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_max_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_linspace_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_range_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_abs_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_gth_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_gte_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_lth_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_lte_i754(u3_noun, u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_trace_i754(u3_noun, u3_noun, u3_noun); + u3_noun u3qi_la_mmul_i754(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun); + +# define u3qfu_van_fan 28 +# define u3qfu_van_rib 58 +# define u3qfu_van_vet 59 + + void u3qf_test(const c3_c*, u3_noun); + + + /** Tier 6. + **/ + u3_noun u3qg_plot_fax(u3_noun, u3_noun); + u3_noun u3qg_plot_met(u3_noun, u3_noun); + +#endif /* ifndef U3_JETS_Q_H */ + diff --git a/vere/pkg/noun/jets/tree.c b/vere/pkg/noun/jets/tree.c new file mode 100644 index 0000000..1735f22 --- /dev/null +++ b/vere/pkg/noun/jets/tree.c @@ -0,0 +1,2658 @@ +/// @file + +/* + These hashes are deprecated, you should instead use no_hashes. + + To generate the hashes, take the sha256 of the jammed battery. For example: + + ``` + > `@ux`(shax (jam -:rip)) + 0x2759.a693.1e9e.f9a5.2c8e.ee43.1088.43d9.4d39.32a6.b04f.86cb.6ba1.5553.4329.3a28 + ``` + + Becomes: + + ``` + 2759a6931e9ef9a52c8eee43108843d94d3932a6b04f86cb6ba1555343293a28 + ``` +*/ + +#include "c3/c3.h" +#include "jets.h" +#include "jets/w.h" + +static c3_c* no_hashes[] = { 0 }; + + + static u3j_harm _140_hex_mimes_base16_en_a[] = {{".2", u3we_en_base16}, {}}; + static c3_c* _140_hex_mimes_base16_en_ha[] = { + "669807766b6802719769fcbfe149d77fb352fcf0922afaf35dc4ab8c201d84e5", + 0 + }; + static u3j_harm _140_hex_mimes_base16_de_a[] = {{".2", u3we_de_base16}, {}}; + static c3_c* _140_hex_mimes_base16_de_ha[] = { + "f1e04d0f452f2783e17b3bd5bbbcf95a651624fe7a2aca28dd9a7feae1319734", + 0 + }; + static u3j_core _140_hex_mimes_base16_d[] = + { { "en", 7, _140_hex_mimes_base16_en_a, 0, _140_hex_mimes_base16_en_ha }, + { "de", 7, _140_hex_mimes_base16_de_a, 0, _140_hex_mimes_base16_de_ha }, + {} + }; + static c3_c* _140_hex_mimes_base16_ha[] = { + "c71bdcc8542fd49aa307f296ac097e300a714fb3b3d1e475426f0916fa61f12c", + 0 + }; +static u3j_core _140_hex_mimes_d[] = + { { "base16", 3, 0, _140_hex_mimes_base16_d, _140_hex_mimes_base16_ha }, + {} + }; +static c3_c* _140_hex_mimes_ha[] = { + "bca2510fd7172643812f9d224deb95ddd69400c990db3d8cfb517a7292e8f06e", + 0 +}; + + static u3j_harm _140_hex_aes_ecba_en_a[] = {{".2", u3wea_ecba_en}, {}}; + static c3_c* _140_hex_aes_ecba_en_ha[] = { + "d7674ad72666a787580c52785c5d4d37ca462ba05e904efbeded5d1bd8b02b4b", + 0 + }; + static u3j_harm _140_hex_aes_ecba_de_a[] = {{".2", u3wea_ecba_de}, {}}; + static c3_c* _140_hex_aes_ecba_de_ha[] = { + "6e6599e93bea2e4297b621814bfb17a9b10849f920d50b14e808ef2e4fe62383", + 0 + }; + static u3j_core _140_hex_aes_ecba_d[] = + { { "en", 7, _140_hex_aes_ecba_en_a, 0, _140_hex_aes_ecba_en_ha }, + { "de", 7, _140_hex_aes_ecba_de_a, 0, _140_hex_aes_ecba_de_ha }, + {} + }; + static c3_c* _140_hex_aes_ecba_ha[] = { + "693409d27b777f73ce92cebd38e9ebceebe1e9c27ad8c9de9afc091e31bd7d9f", + 0 + }; + + static u3j_harm _140_hex_aes_ecbb_en_a[] = {{".2", u3wea_ecbb_en}, {}}; + static c3_c* _140_hex_aes_ecbb_en_ha[] = { + "2c0e3c8f4d741b37324563ecd0ab8fbf87721d1e017f1eeeaf8b6a60515c483b", + 0 + }; + static u3j_harm _140_hex_aes_ecbb_de_a[] = {{".2", u3wea_ecbb_de}, {}}; + static c3_c* _140_hex_aes_ecbb_de_ha[] = { + "cf78f314a1dbbc53b28d6405b98c66a4451350757872d8f7cf0477411e731acc", + 0 + }; + static u3j_core _140_hex_aes_ecbb_d[] = + { { "en", 7, _140_hex_aes_ecbb_en_a, 0, _140_hex_aes_ecbb_en_ha }, + { "de", 7, _140_hex_aes_ecbb_de_a, 0, _140_hex_aes_ecbb_de_ha }, + {} + }; + static c3_c* _140_hex_aes_ecbb_ha[] = { + "7255c39f10e068007d0d64dd40e4f6e83492ed2e3222919440be0d28fd42a5e3", + 0 + }; + + static u3j_harm _140_hex_aes_ecbc_en_a[] = {{".2", u3wea_ecbc_en}, {}}; + static c3_c* _140_hex_aes_ecbc_en_ha[] = { + "f56450f2662082e27ba1aecd2fe04c66aa8641d6eb155f8d3707e242a1e1cf1c", + 0 + }; + static u3j_harm _140_hex_aes_ecbc_de_a[] = {{".2", u3wea_ecbc_de}, {}}; + static c3_c* _140_hex_aes_ecbc_de_ha[] = { + "28c8c44002799fbe94d4aa07922f2b74dbbf234c84684cd8c3187622b4be6a5f", + 0 + }; + static u3j_core _140_hex_aes_ecbc_d[] = + { { "en", 7, _140_hex_aes_ecbc_en_a, 0, _140_hex_aes_ecbc_en_ha }, + { "de", 7, _140_hex_aes_ecbc_de_a, 0, _140_hex_aes_ecbc_de_ha }, + {} + }; + static c3_c* _140_hex_aes_ecbc_ha[] = { + "65da73b8de06a6660ca2d36be881b708362e1f8bc12c01290aed90fdb2977667", + 0 + }; + + static u3j_harm _140_hex_aes_cbca_en_a[] = {{".2", u3wea_cbca_en}, {}}; + static c3_c* _140_hex_aes_cbca_en_ha[] = { + "f85366d520b3179c5dabfb58ee1fa0554f5044f676340439db875841cd4058de", + 0 + }; + static u3j_harm _140_hex_aes_cbca_de_a[] = {{".2", u3wea_cbca_de}, {}}; + static c3_c* _140_hex_aes_cbca_de_ha[] = { + "8b876fbdb1849d8fbabba5e143aea0532a0e5dfff1c784d7ad15fd497ea376b1", + 0 + }; + static u3j_core _140_hex_aes_cbca_d[] = + { { "en", 7, _140_hex_aes_cbca_en_a, 0, _140_hex_aes_cbca_en_ha }, + { "de", 7, _140_hex_aes_cbca_de_a, 0, _140_hex_aes_cbca_de_ha }, + {} + }; + static c3_c* _140_hex_aes_cbca_ha[] = { + "420d04c03b7816b656fe4e8d9fce04f7e6d51d3d274c6511e89cfdb43ebf107e", + 0 + }; + + static u3j_harm _140_hex_aes_cbcb_en_a[] = {{".2", u3wea_cbcb_en}, {}}; + static c3_c* _140_hex_aes_cbcb_en_ha[] = { + "6f961e0629c5efce47793e6a352220d355bb8fba6656c6941a68efb3ba10999d", + 0 + }; + static u3j_harm _140_hex_aes_cbcb_de_a[] = {{".2", u3wea_cbcb_de}, {}}; + static c3_c* _140_hex_aes_cbcb_de_ha[] = { + "7ee2f33f80612e91fda1fd84201266dea6cab596a4e23a535d1a14fb0763f1a3", + 0 + }; + static u3j_core _140_hex_aes_cbcb_d[] = + { { "en", 7, _140_hex_aes_cbcb_en_a, 0, _140_hex_aes_cbcb_en_ha }, + { "de", 7, _140_hex_aes_cbcb_de_a, 0, _140_hex_aes_cbcb_de_ha }, + {} + }; + static c3_c* _140_hex_aes_cbcb_ha[] = { + "1b84daab497795f2afd7238a6a6090be68b78eb6051b0ffa076b2ed9fedeebe5", + 0 + }; + + static u3j_harm _140_hex_aes_cbcc_en_a[] = {{".2", u3wea_cbcc_en}, {}}; + static c3_c* _140_hex_aes_cbcc_en_ha[] = { + "b2578cf17a3095f48cc96cf7690dd7ab4f4e0b76b2578eadc1dce31a075f5b12", + 0 + }; + static u3j_harm _140_hex_aes_cbcc_de_a[] = {{".2", u3wea_cbcc_de}, {}}; + static c3_c* _140_hex_aes_cbcc_de_ha[] = { + "36586f89d702bedb8c2a01ea3614f61627e762488e373106cbb1b27c46e3493c", + 0 + }; + static u3j_core _140_hex_aes_cbcc_d[] = + { { "en", 7, _140_hex_aes_cbcc_en_a, 0, _140_hex_aes_cbcc_en_ha }, + { "de", 7, _140_hex_aes_cbcc_de_a, 0, _140_hex_aes_cbcc_de_ha }, + {} + }; + static c3_c* _140_hex_aes_cbcc_ha[] = { + "3bab1a59c7673afeb659821d54754e8e5e281243e79624fdbe4d7f85cae192c5", + 0 + }; + + static u3j_harm _140_hex_aes_siva_en_a[] = {{".2", u3wea_siva_en}, {}}; + static c3_c* _140_hex_aes_siva_en_ha[] = { + "2a137039301788b8540ed81cbfafe450c9306348d02a6576f5c14f6d6f20ba81", + 0 + }; + static u3j_harm _140_hex_aes_siva_de_a[] = {{".2", u3wea_siva_de}, {}}; + static c3_c* _140_hex_aes_siva_de_ha[] = { + "d0130e9229e71c589429dd87843dc104bc4ee5b426400a547081d8c91a548eaa", + 0 + }; + static u3j_core _140_hex_aes_siva_d[] = + { { "en", 7, _140_hex_aes_siva_en_a, 0, _140_hex_aes_siva_en_ha }, + { "de", 7, _140_hex_aes_siva_de_a, 0, _140_hex_aes_siva_de_ha }, + {} + }; + static c3_c* _140_hex_aes_siva_ha[] = { + "435c5c769d2522d71ab60332bb57440d69c6803d5ca9a5faae88c825cb55d72e", + 0 + }; + + static u3j_harm _140_hex_aes_sivb_en_a[] = {{".2", u3wea_sivb_en}, {}}; + static c3_c* _140_hex_aes_sivb_en_ha[] = { + "1638f56e8728f285e4175c7b514c5a4e1a24205acf33e105f0513cad7ae843cf", + 0 + }; + static u3j_harm _140_hex_aes_sivb_de_a[] = {{".2", u3wea_sivb_de}, {}}; + static c3_c* _140_hex_aes_sivb_de_ha[] = { + "64c9b199fffd6d31baf7457bf27d5a510121be45201b2ae5cc1d9565c0bdd0ff", + 0 + }; + static u3j_core _140_hex_aes_sivb_d[] = + { { "en", 7, _140_hex_aes_sivb_en_a, 0, _140_hex_aes_sivb_en_ha }, + { "de", 7, _140_hex_aes_sivb_de_a, 0, _140_hex_aes_sivb_de_ha }, + {} + }; + static c3_c* _140_hex_aes_sivb_ha[] = { + "0683f3f9067c2a16f68805c778c404179dc5df9019bbbe0f8d680a99a69e61fc", + 0 + }; + + static u3j_harm _140_hex_aes_sivc_en_a[] = {{".2", u3wea_sivc_en}, {}}; + static c3_c* _140_hex_aes_sivc_en_ha[] = { + "d721486dea943efd52d9e6450f4f48dd191c89637a2f842d3ff6edfd3beecbb9", + 0 + }; + static u3j_harm _140_hex_aes_sivc_de_a[] = {{".2", u3wea_sivc_de}, {}}; + static c3_c* _140_hex_aes_sivc_de_ha[] = { + "3ded831b992ea100582229a4d1d9b5c80380128ae6b59b5bb36403ed13dc5d55", + 0 + }; + static u3j_core _140_hex_aes_sivc_d[] = + { { "en", 7, _140_hex_aes_sivc_en_a, 0, _140_hex_aes_sivc_en_ha }, + { "de", 7, _140_hex_aes_sivc_de_a, 0, _140_hex_aes_sivc_de_ha }, + {} + }; + static c3_c* _140_hex_aes_sivc_ha[] = { + "23ef582f110d28aff82b0795305b02e5a718d667bcae97091c08bc26790e7176", + 0 + }; +static u3j_core _140_hex_aes_d[] = + { { "ecba", 7, 0, _140_hex_aes_ecba_d, _140_hex_aes_ecba_ha }, + { "ecbb", 7, 0, _140_hex_aes_ecbb_d, _140_hex_aes_ecbb_ha }, + { "ecbc", 7, 0, _140_hex_aes_ecbc_d, _140_hex_aes_ecbc_ha }, + { "cbca", 7, 0, _140_hex_aes_cbca_d, _140_hex_aes_cbca_ha }, + { "cbcb", 7, 0, _140_hex_aes_cbcb_d, _140_hex_aes_cbcb_ha }, + { "cbcc", 7, 0, _140_hex_aes_cbcc_d, _140_hex_aes_cbcc_ha }, + { "siva", 7, 0, _140_hex_aes_siva_d, _140_hex_aes_siva_ha }, + { "sivb", 7, 0, _140_hex_aes_sivb_d, _140_hex_aes_sivb_ha }, + { "sivc", 7, 0, _140_hex_aes_sivc_d, _140_hex_aes_sivc_ha }, + {} + }; +static c3_c* _140_hex_aes_ha[] = { + "ca4c1b0cff03db74ceca1b844f0223d669aa42934152a784d431469f0eb71527", + 0 +}; + +static u3j_harm _140_hex_leer_a[] = {{".2", u3we_leer}, {}}; +static c3_c* _140_hex_leer_ha[] = { + "8a4486bb09639f6b8cf7631f9bf883256529c6d7d9aa320ab6dfa5517611f0d7", + 0 +}; +static u3j_harm _140_hex_lore_a[] = {{".2", u3we_lore}, {}}; +static c3_c* _140_hex_lore_ha[] = { + "19b13cfea49fd14aafbb20b8b888ba454f809c3f50a7cfeebd43f87336fe052d", + 0 +}; +static u3j_harm _140_hex_loss_a[] = {{".2", u3we_loss}, {}}; +static c3_c* _140_hex_loss_ha[] = { + "67aacd21484078828ad4342297d44c38d9213b8809f83f695c2996378a92dc2a", + 0 +}; +static u3j_harm _140_hex_lune_a[] = {{".2", u3we_lune}, {}}; +static c3_c* _140_hex_lune_ha[] = { + "417472f35b885fe6dd0715e78fd0920cb59f68b738aadc9768e73bc5efa0e570", + 0 +}; + +static u3j_harm _140_hex_coed__ed_puck_a[] = {{".2", u3wee_puck}, {}}; +static c3_c* _140_hex_coed__ed_puck_ha[] = { + "1bc694675842345c50b0e20a2193bb5bcbb42f163fc832431a3d1822a81e4c98", + 0 +}; + +static u3j_harm _140_hex_coed__ed_sign_a[] = {{".2", u3wee_sign}, {}}; + +static u3j_harm _140_hex_coed__ed_sign_octs_a[] = {{".2", u3wee_sign_octs}, {}}; +static c3_c* _140_hex_coed__ed_sign_octs_ha[] = { + "34ad749bf8443611cbf1f7de90a066318bd12be36f2f7f6f55281f6f7ed79754", + 0 +}; + +static u3j_harm _140_hex_coed__ed_veri_a[] = {{".2", u3wee_veri}, {}}; + +static u3j_harm _140_hex_coed__ed_veri_octs_a[] = {{".2", u3wee_veri_octs}, {}}; +static c3_c* _140_hex_coed__ed_veri_octs_ha[] = { + "047a7eeccb2e68aeeee631b6db86e11a5a3aa9e179660553eca6304327612dcf", + 0 +}; +static u3j_harm _140_hex_coed__ed_shar_a[] = {{".2", u3wee_shar}, {}}; +static c3_c* _140_hex_coed__ed_shar_ha[] = { + "52d3b0a2f51f2b0a9dd72bb33db38c73dc873029c365d871d0559a1472a80e72", + 0 +}; + + static u3j_harm _140_hex_coed__ed_point_add_a[] = + {{".2", u3wee_point_add}, {}}; + + static u3j_harm _140_hex_coed__ed_scalarmult_a[] = + {{".2", u3wee_scalarmult}, {}}; + static c3_c* _140_hex_coed__ed_scalarmult_ha[] = { + "72e71cd3aa3af429cd65baa78632500c60edd1d4c82a39d3ba7f231ef97e6316", + 0 + }; + + static u3j_harm _140_hex_coed__ed_scalarmult_base_a[] = + {{".2", u3wee_scalarmult_base}, {}}; + static c3_c* _140_hex_coed__ed_scalarmult_base_ha[] = { + "976fdb8251f9b767af689a0d2c41b88941921bf53777c1ceeb5297511021f9d8", + 0 + }; + + static u3j_harm _140_hex_coed__ed_add_scalarmult_scalarmult_base_a[] = + {{".2", u3wee_add_scalarmult_scalarmult_base}, {}}; + static c3_c* _140_hex_coed__ed_add_scalarmult_scalarmult_base_ha[] = { + "11819071c24a2d7b36daea6e16c78b2e05f9ca3e857cf4815ffe652ce677a61a", + 0 + }; + + static u3j_harm _140_hex_coed__ed_add_double_scalarmult_a[] = + {{".2", u3wee_add_double_scalarmult}, {}}; + static c3_c* _140_hex_coed__ed_add_double_scalarmult_ha[] = { + "0fab78a1e890e53cecade1c22b95813db77e066044e33417a0919695b6cde9ba", + 0 + }; + +static u3j_core _140_hex_coed__ed_d[] = + { { "sign", 7, _140_hex_coed__ed_sign_a, 0, no_hashes }, + { "sign-octs", 7, _140_hex_coed__ed_sign_octs_a, 0, _140_hex_coed__ed_sign_octs_ha }, + { "puck", 7, _140_hex_coed__ed_puck_a, 0, _140_hex_coed__ed_puck_ha }, + { "veri", 7, _140_hex_coed__ed_veri_a, 0, no_hashes }, + { "veri-octs", 7, _140_hex_coed__ed_veri_octs_a, 0, _140_hex_coed__ed_veri_octs_ha }, + { "shar", 7, _140_hex_coed__ed_shar_a, 0, _140_hex_coed__ed_shar_ha }, + { "point-add", 7, _140_hex_coed__ed_point_add_a, 0, 0 }, + { "scalarmult", 7, _140_hex_coed__ed_scalarmult_a, 0, + _140_hex_coed__ed_scalarmult_ha }, + { "scalarmult-base", 7, _140_hex_coed__ed_scalarmult_base_a, 0, + _140_hex_coed__ed_scalarmult_base_ha }, + { "add-scalarmult-scalarmult-base", 7, + _140_hex_coed__ed_add_scalarmult_scalarmult_base_a, 0, + _140_hex_coed__ed_add_scalarmult_scalarmult_base_ha }, + { "add-double-scalarmult", 7, + _140_hex_coed__ed_add_double_scalarmult_a, 0, + _140_hex_coed__ed_add_double_scalarmult_ha }, + {} + }; +static c3_c* _140_hex_coed__ed_ha[] = { + "7a44a962aa72933588b5c99a8b68ebac21ce3c4710c081cb66b3599b45af9ced", + 0 +}; + +static u3j_core _140_hex_coed_d[] = +{ { "ed", 3, 0, _140_hex_coed__ed_d, _140_hex_coed__ed_ha }, + {} +}; +static c3_c* _140_hex_coed_ha[] = { + "4be0254f06d953b69509eb15550595ffad8767d3c3dc2dafcd7c22f92f7704c4", + 0 +}; + + static u3j_harm _140_hex_hmac_hmac_a[] = {{".2", u3we_hmac}, {}}; + static c3_c* _140_hex_hmac_hmac_ha[] = { + "d0dbd778156aef21d18f44a8cffd87296826120af5a4af020dd7aff0f95f03b1", + 0 + }; +static u3j_core _140_hex_hmac_d[] = + { { "hmac", 7, _140_hex_hmac_hmac_a, 0, _140_hex_hmac_hmac_ha }, + {} + }; +static c3_c* _140_hex_hmac_ha[] = { + "976bb4508dbe659eb12aa32d4a481dbd885e40f8a15c505762f1acf43b744234", + 0 +}; + + static u3j_harm _140_hex_argon2_a[] = {{".2", u3we_argon2}, {}}; + static c3_c* _140_hex_argon2_ha[] = { + "4df7cec141ffa2cc76b058846474ca42cc9840666ee3e7e80e565803e83ea98b", + 0 + }; +static u3j_core _140_hex_argon_d[] = + { { "argon2", 511, _140_hex_argon2_a, 0, _140_hex_argon2_ha }, + {} + }; +static c3_c* _140_hex_argon_ha[] = { + "dc704c786192ecd09d4c206a8f28db3202b6e0eb03e3ce63a95987510ac312d6", + 0 +}; + + static u3j_harm _140_hex_scr_pbk_a[] = {{".2", u3wes_pbk, c3y}, {}}; + static c3_c* _140_hex_scr_pbk_ha[] = { 0 }; + static u3j_harm _140_hex_scr_pbl_a[] = {{".2", u3wes_pbl, c3y}, {}}; + static c3_c* _140_hex_scr_pbl_ha[] = { 0 }; + static u3j_harm _140_hex_scr_hsh_a[] = {{".2", u3wes_hsh, c3y}, {}}; + static c3_c* _140_hex_scr_hsh_ha[] = { 0 }; + static u3j_harm _140_hex_scr_hsl_a[] = {{".2", u3wes_hsl, c3y}, {}}; + static c3_c* _140_hex_scr_hsl_ha[] = { 0 }; +static u3j_core _140_hex_scr_d[] = + { { "pbk", 7, _140_hex_scr_pbk_a, 0, _140_hex_scr_pbk_ha }, + { "pbl", 7, _140_hex_scr_pbl_a, 0, _140_hex_scr_pbl_ha }, + { "hsh", 7, _140_hex_scr_hsh_a, 0, _140_hex_scr_hsh_ha }, + { "hsl", 7, _140_hex_scr_hsl_a, 0, _140_hex_scr_hsl_ha }, + {} + }; +static c3_c* _140_hex_scr_ha[] = { 0 }; + + static u3j_harm _140_hex_secp_secp256k1_make_a[] = {{".2", u3we_make, c3y}, {}}; + static c3_c* _140_hex_secp_secp256k1_make_ha[] = { 0 }; + static u3j_harm _140_hex_secp_secp256k1_sign_a[] = {{".2", u3we_sign, c3y}, {}}; + static c3_c* _140_hex_secp_secp256k1_sign_ha[] = { 0 }; + static u3j_harm _140_hex_secp_secp256k1_reco_a[] = {{".2", u3we_reco, c3y}, {}}; + static c3_c* _140_hex_secp_secp256k1_reco_ha[] = { 0 }; + + static u3j_harm _140_hex_secp_secp256k1_schnorr_sosi_a[] = + {{".2", u3we_sosi}, {}}; + static c3_c* _140_hex_secp_secp256k1_schnorr_sosi_ha[] = { 0 }; + static u3j_harm _140_hex_secp_secp256k1_schnorr_sove_a[] = + {{".2", u3we_sove}, {}}; + static c3_c* _140_hex_secp_secp256k1_schnorr_sove_ha[] = { 0 }; + static u3j_core _140_hex_secp_secp256k1_schnorr_d[] = + { { "sosi", 7, + _140_hex_secp_secp256k1_schnorr_sosi_a, 0, + _140_hex_secp_secp256k1_schnorr_sosi_ha }, + { "sove", 7, + _140_hex_secp_secp256k1_schnorr_sove_a, 0, + _140_hex_secp_secp256k1_schnorr_sove_ha }, + {} + }; + static c3_c* _140_hex_secp_secp256k1_schnorr_ha[] = { 0 }; + + static u3j_core _140_hex_secp_secp256k1_d[] = + { { "make", 7, _140_hex_secp_secp256k1_make_a, 0, _140_hex_secp_secp256k1_make_ha }, + { "sign", 7, _140_hex_secp_secp256k1_sign_a, 0, _140_hex_secp_secp256k1_sign_ha }, + { "reco", 7, _140_hex_secp_secp256k1_reco_a, 0, _140_hex_secp_secp256k1_reco_ha }, + { "schnorr", 7, 0, + _140_hex_secp_secp256k1_schnorr_d, + _140_hex_secp_secp256k1_schnorr_ha }, + {} + }; + static c3_c* _140_hex_secp_secp256k1_ha[] = { + "e7fc0971a970aba7ded43bd89e9c82623eb2f346c9c720c63b22f2a646927861", + 0 + }; +static u3j_core _140_hex_secp_d[] = + { { "secp256k1", 3, 0, _140_hex_secp_secp256k1_d, _140_hex_secp_secp256k1_ha }, + {} + }; +static c3_c* _140_hex_secp_ha[] = { + "9f5c23f0e7923b6cf1603388ba52401b6e43881be3560b3acfaab20b25071792", + 0 +}; + + static u3j_harm _140_hex_blake2b_a[] = {{".2", u3we_blake2b, c3y}, {}}; + +static u3j_core _140_hex_blake_d[] = + { { "blake2b", 7, _140_hex_blake2b_a, 0, no_hashes }, + {} + }; +static c3_c* _140_hex_blake_ha[] = { + "ff30d99ffb3e13d8aa50b2b8461c8edfabf0e76de22312d16d1d6daaf3636b5f", + 0 +}; + + static u3j_harm _140_hex_kecc_k224_a[] = + {{".2", u3we_kecc224, c3y, c3y, c3y}, {}}; + static u3j_harm _140_hex_kecc_k256_a[] = + {{".2", u3we_kecc256, c3y, c3y, c3y}, {}}; + static u3j_harm _140_hex_kecc_k384_a[] = + {{".2", u3we_kecc384, c3y, c3y, c3y}, {}}; + static u3j_harm _140_hex_kecc_k512_a[] = + {{".2", u3we_kecc512, c3y, c3y, c3y}, {}}; +static u3j_core _140_hex_kecc_d[] = + { { "k224", 7, _140_hex_kecc_k224_a, 0, no_hashes }, + { "k256", 7, _140_hex_kecc_k256_a, 0, no_hashes }, + { "k384", 7, _140_hex_kecc_k384_a, 0, no_hashes }, + { "k512", 7, _140_hex_kecc_k512_a, 0, no_hashes }, + {} + }; + + static u3j_harm _140_hex_ripemd_160_a[] = {{".2", u3we_ripe, c3y}, {}}; + static c3_c* _140_hex_ripemd_160_ha[] = { + "176684b29926a01f5c60fa584e4691b0cbdc9b93608dcbe7d0cf3585683fa42f", + 0 + }; +static u3j_core _140_hex_ripe_d[] = + { { "ripemd160", 7, _140_hex_ripemd_160_a, 0, _140_hex_ripemd_160_ha }, + {} + }; +static c3_c* _140_hex_ripe_ha[] = { + "b0cb16bf206c0496bb480e5759ea1afa7dee1748b64e5243c23fddb09720ebd0", + 0 +}; + +static u3j_core _140_hex_d[] = +{ { "lore", 63, _140_hex_lore_a, 0, _140_hex_lore_ha }, + { "leer", 63, _140_hex_leer_a, 0, _140_hex_leer_ha }, + { "loss", 63, _140_hex_loss_a, 0, _140_hex_loss_ha }, + { "lune", 127, _140_hex_lune_a, 0, _140_hex_lune_ha }, + + { "coed", 63, 0, _140_hex_coed_d, _140_hex_coed_ha }, + { "aes", 31, 0, _140_hex_aes_d, _140_hex_aes_ha }, + + { "hmac", 63, 0, _140_hex_hmac_d, _140_hex_hmac_ha }, + { "argon", 31, 0, _140_hex_argon_d, _140_hex_argon_ha }, + { "blake", 31, 0, _140_hex_blake_d, _140_hex_blake_ha }, + { "kecc", 31, 0, _140_hex_kecc_d, no_hashes }, + { "ripemd", 31, 0, _140_hex_ripe_d, _140_hex_ripe_ha }, + { "scr", 31, 0, _140_hex_scr_d, _140_hex_scr_ha }, + { "secp", 6, 0, _140_hex_secp_d, _140_hex_secp_ha }, + { "mimes", 31, 0, _140_hex_mimes_d, _140_hex_mimes_ha }, + {} +}; +static c3_c* _140_hex_ha[] = { + "7e393356dd7ac64eed5cd9f5cf0e320d401ca36a0a0ce0f954e7538824114844", + 0 +}; + + +/* layer five +*/ +static u3j_harm _140_pen_cell_a[] = {{".2", u3wf_cell}, {}}; +static c3_c* _140_pen_cell_ha[] = { + "411649e69ff5c5d4a2976b300d213b99af3de724cec0e95f48404b808fc4f428", + 0 +}; +static u3j_harm _140_pen_comb_a[] = {{".2", u3wf_comb}, {}}; +static c3_c* _140_pen_comb_ha[] = { + "f9e37c3b3d5036c31af60f7047391594068638b54db7cf94bfea9dabbdffa547", + 0 +}; +static u3j_harm _140_pen_cons_a[] = {{".2", u3wf_cons}, {}}; +static c3_c* _140_pen_cons_ha[] = { + "b698cc6bc49ea0473e344c784075e99a433b4c5738f90fc58ab17c3eaa44b2e9", + 0 +}; +static u3j_harm _140_pen_core_a[] = {{".2", u3wf_core}, {}}; +static c3_c* _140_pen_core_ha[] = { + "1180e9371cf3465783ef192f9a7f580cd90533f5b52b77b456287f1d580a3535", + 0 +}; +static u3j_harm _140_pen_face_a[] = {{".2", u3wf_face}, {}}; +static c3_c* _140_pen_face_ha[] = { + "a184c44d57f5c94b84a3258b05bf891f3c96a4a4bbff3a8934d11cad0efa81d8", + 0 +}; +static u3j_harm _140_pen_fitz_a[] = {{".2", u3wf_fitz}, {}}; +static c3_c* _140_pen_fitz_ha[] = { + "469abe976ec15eeff9a87bce385f2c87c9bd89814ce2858aa9fee094beea1e5d", + 0 +}; +static u3j_harm _140_pen_flan_a[] = {{".2", u3wf_flan_139}, {}}; +static c3_c* _140_pen_flan_ha[] = { + "cc00cb9373b0274af4e17d7acd77f65d8a2fa886e422c949c12d9d9e7cb3525b", + 0 +}; +static u3j_harm _140_pen_flip_a[] = {{".2", u3wf_flip_139}, {}}; +static c3_c* _140_pen_flip_ha[] = { + "6e97fab9d039e715a30af5da93ef97389babfdcae7ef87655d278e77a1af0f0c", + 0 +}; +static u3j_harm _140_pen_flor_a[] = {{".2", u3wf_flor_139}, {}}; +static c3_c* _140_pen_flor_ha[] = { + "ab5360aacf0c9a325727e90e1caea9c42f5d94ccc248c9e1f253b0922b4c4e63", + 0 +}; +static u3j_harm _140_pen_fork_a[] = {{".2", u3wf_fork}, {}}; +static c3_c* _140_pen_fork_ha[] = { + "36f0ea0e2eb30328b8b83ed43a81c8c9a1f5b4c5a03fd68fd25701991a40b9dd", + 0 +}; + +static u3j_harm _140_pen_look_a[] = {{".2", u3wf_look}, {}}; +static c3_c* _140_pen_look_ha[] = { + "fdda2166a2b9e1a9bda6ab375dd6fb6c610e18f54636a5e89896b45fd0a7169b", + 0 +}; +static u3j_harm _140_pen_loot_a[] = {{".2", u3wf_loot}, {}}; +static c3_c* _140_pen_loot_ha[] = { + "e275da4562ae6da9bd333aeae6b9829e886874c8b891898c0ef5306268eb45c1", + 0 +}; + + static u3j_harm _140_pen__ut_crop_a[] = {{".2", u3wfu_crop}, {}}; + static c3_c* _140_pen__ut_crop_ha[] = { + "e2c6fc3e714a3a98ccd28423dcb9f2c6480935e26b54dd0581eb2ad7e5b16d6f", + 0 + }; + static u3j_harm _140_pen__ut_fish_a[] = {{".2", u3wfu_fish}, {}}; + static c3_c* _140_pen__ut_fish_ha[] = { + "080caee60b5ee4616bf9568bdbceabbf044379c47466e0ae3968cb0146049a84", + 0 + }; + static u3j_harm _140_pen__ut_fuse_a[] = {{".2", u3wfu_fuse}, {}}; + static c3_c* _140_pen__ut_fuse_ha[] = { + "519aac7b40b7018d5df00ddf3977c2ebe0c2e05bcee34796d56a1d54c15e0c84", + 0 + }; + static u3j_harm _140_pen__ut_mint_a[] = {{".2", u3wfu_mint}, {}}; + static c3_c* _140_pen__ut_mint_ha[] = { + "7d980f7425b51bb10fbbd8b465b5d83f5dd4cb6e66d88758a9f7490b812a765e", + 0 + }; + static u3j_harm _140_pen__ut_mull_a[] = {{".2", u3wfu_mull}, {}}; + static c3_c* _140_pen__ut_mull_ha[] = { + "c806329aefd920501ea0faa0cfb0ce3280a74408782efe6d82878ec43ec44fb7", + 0 + }; + + static u3j_harm _140_pen__ut_nest_dext_a[] = {{".2", u3wfu_nest_dext}, {}}; + static c3_c* _140_pen__ut_nest_dext_ha[] = { + "72f33df96800034fc63531293f9b110e6505027195bf8a10ff94b9a1f1ef719b", + 0 + }; + static u3j_core _140_pen__ut_nest_in_d[] = + { + { "nest-dext", 3, _140_pen__ut_nest_dext_a, 0, _140_pen__ut_nest_dext_ha }, + {} + }; + static c3_c* _140_pen__ut_nest_in_ha[] = { + "68378dfa1d1fee0b1cd9593fb561234cec2ae9371a5ffa287c3d2ab9620e198c", + 0 + }; + static u3j_core _140_pen__ut_nest_d[] = + { + { "nest-in", 7, 0, _140_pen__ut_nest_in_d, _140_pen__ut_nest_in_ha }, + {} + }; + static c3_c* _140_pen__ut_nest_ha[] = { + "1e8de5d1225facc1158c92c2ea5e0dc84129cbb317fde3691e224b8c2550d950", + 0 + }; + + static u3j_harm _140_pen__ut_rest_a[] = {{".2", u3wfu_rest}, {}}; + static c3_c* _140_pen__ut_rest_ha[] = { + "b4a83073f4cb03898ef099fab5722a046122dc96a5332ffc82f988df6c186e74", + 0 + }; + +static u3j_core _140_pen__ut_d[] = + { + { "crop", 7, _140_pen__ut_crop_a, 0, _140_pen__ut_crop_ha }, + { "fish", 7, _140_pen__ut_fish_a, 0, _140_pen__ut_fish_ha }, + { "fuse", 7, _140_pen__ut_fuse_a, 0, _140_pen__ut_fuse_ha }, + { "mint", 7, _140_pen__ut_mint_a, 0, _140_pen__ut_mint_ha }, + { "mull", 7, _140_pen__ut_mull_a, 0, _140_pen__ut_mull_ha }, + { "nest", 7, 0, _140_pen__ut_nest_d, _140_pen__ut_nest_ha }, + { "rest", 7, _140_pen__ut_rest_a, 0, _140_pen__ut_rest_ha }, + {} + }; +static c3_c* _140_pen__ut_ha[] = { + "50c79204c82a3ba8f01e085a2e27e7716e5c7ab1929f94423ef1da92cf5ac631", + 0 +}; + +static u3j_hood _140_pen__ut_ho[] = + { { "ar", 12282 }, + { "fan", 28, c3n }, + { "rib", 58, c3n }, + { "vet", 59, c3n }, + + { "blow", 6015 }, + { "burp", 342 }, + { "busk", 1373 }, + { "buss", 374 }, + { "crop", 1494 }, + { "duck", 1524 }, + { "dune", 2991 }, + { "dunk", 3066 }, + { "epla", 12206 }, + { "emin", 1534 }, + { "emul", 6134 }, + { "feel", 1502 }, + { "felt", 94 }, + { "fine", 49086 }, + { "fire", 4 }, + { "fish", 6006 }, + { "fond", 12283 }, + { "fund", 6014 }, + // XX +funk is not part of +ut, and this hook appears to be unused + // remove from here and the +ut hint + // + { "funk", 0xbefafa, c3y, 31 }, + { "fuse", 24021 }, + { "gain", 380 }, + { "lose", 0x2fefe }, + { "mile", 382 }, + { "mine", 372 }, + { "mint", 49083 }, + { "moot", 0x2feff }, + { "mull", 24020 }, + { "nest", 92 }, + { "peel", 1526 }, + { "play", 3006 }, + { "peek", 1532 }, + { "repo", 22 }, + { "rest", 6102 }, + { "tack", 6007 }, + { "toss", 24540 }, + { "wrap", 6140 }, + {}, + }; + +static u3j_core _140_pen_d[] = +{ { "hex", 7, 0, _140_hex_d, _140_hex_ha }, + + { "cell", 7, _140_pen_cell_a, 0, _140_pen_cell_ha }, + { "comb", 7, _140_pen_comb_a, 0, _140_pen_comb_ha }, + { "cons", 7, _140_pen_cons_a, 0, _140_pen_cons_ha }, + { "core", 7, _140_pen_core_a, 0, _140_pen_core_ha }, + { "face", 7, _140_pen_face_a, 0, _140_pen_face_ha }, + { "fitz", 7, _140_pen_fitz_a, 0, _140_pen_fitz_ha }, + { "flan", 7, _140_pen_flan_a, 0, _140_pen_flan_ha }, + { "flip", 7, _140_pen_flip_a, 0, _140_pen_flip_ha }, + { "flor", 7, _140_pen_flor_a, 0, _140_pen_flor_ha }, + { "fork", 7, _140_pen_fork_a, 0, _140_pen_fork_ha }, + { "look", 7, _140_pen_look_a, 0, _140_pen_look_ha }, + { "loot", 7, _140_pen_loot_a, 0, _140_pen_loot_ha }, + { "ut", 15, 0, _140_pen__ut_d, _140_pen__ut_ha, _140_pen__ut_ho }, + {} +}; +static c3_c* _140_pen_ha[] = { + "e6c9e2362bdf2d1f9a2837a0efa154c0b8b9d51aea03a86b5aece573ff423cb1", + 0 +}; + +static u3j_hood _140_pen_ho[] = { + { "ap", 22 }, + { "ut", 86 }, + {}, +}; + + +/* layer four +*/ +static u3j_harm _140_qua_trip_a[] = {{".2", u3we_trip}, {}}; +static c3_c* _140_qua_trip_ha[] = { + "05423b940d10d03891cc23f36eea14b233e5884ef539de3d985d6818dd427b05", + 0 +}; + +static u3j_harm _140_qua_slaw_a[] = {{".2", u3we_slaw}, {}}; +static c3_c* _140_qua_slaw_ha[] = { + "306c9692f48e2700675ed6581e9df4feaee951e1bed3cad7f89aab392e80000f", + 0 +}; +static u3j_harm _140_qua_scot_a[] = {{".2", u3we_scot}, {}}; +static c3_c* _140_qua_scot_ha[] = { + 0 +}; +static u3j_harm _140_qua_scow_a[] = {{".2", u3we_scow}, {}}; +static c3_c* _140_qua_scow_ha[] = { + 0 +}; + + static u3j_harm _140_qua__po_ind_a[] = {{".2", u3wcp_ind}, {}}; + static c3_c* _140_qua__po_ind_ha[] = { + "95bbe9867dbbd1b9ce12671d64cf7b1dee8d987c6770955a83c73291c4537a61", + 0 + }; + static u3j_harm _140_qua__po_ins_a[] = {{".2", u3wcp_ins}, {}}; + static c3_c* _140_qua__po_ins_ha[] = { + "aae783fb258dff7f8ade49756e01f96a2d2100411a88a886732270dcf9f174f0", + 0 + }; + static u3j_harm _140_qua__po_tod_a[] = {{".2", u3wcp_tod}, {}}; + static c3_c* _140_qua__po_tod_ha[] = { + "153aeba45ca2a87aa918e9cea1b26e8104a6e4395979257b075546c1e2654a17", + 0 + }; + static u3j_harm _140_qua__po_tos_a[] = {{".2", u3wcp_tos}, {}}; + static c3_c* _140_qua__po_tos_ha[] = { + "7c5ffad03bcf8b4ea9bdf0c7f7500351923bc0431f3d62d6ce0472790f668fb4", + 0 + }; +static u3j_core _140_qua__po_d[] = + { { "ind", 7, _140_qua__po_ind_a, 0, _140_qua__po_ind_ha }, + { "ins", 7, _140_qua__po_ins_a, 0, _140_qua__po_ins_ha }, + { "tod", 7, _140_qua__po_tod_a, 0, _140_qua__po_tod_ha }, + { "tos", 7, _140_qua__po_tos_a, 0, _140_qua__po_tos_ha }, + {} + }; +static c3_c* _140_qua__po_ha[] = { + "efc5fa7c0efedd490e9a270bb5cf9f90809e6b224f8a381a6b8a481253b237a1", + 0 +}; + + static u3j_harm _140_qua__bend_fun_a[] = {{".2", u3we_bend_fun}, {}}; + static c3_c* _140_qua__bend_fun_ha[] = { + "e6ea05e3d765a005fccde9eb88fb93e06f0b6ea198afa8ed599b056ba179396a", + 0 + }; +static u3j_core _140_qua__bend_d[] = + { { "fun", 7, _140_qua__bend_fun_a, 0, _140_qua__bend_fun_ha }, + {} + }; +static c3_c* _140_qua__bend_ha[] = { + "adc59c6db6d5b26122bc6c04e25c3efe830c9eef68ecf81c492a59ee5e9e20a2", + 0 +}; + + static u3j_harm _140_qua__cold_fun_a[] = {{".2", u3we_cold_fun}, {}}; + static c3_c* _140_qua__cold_fun_ha[] = { + "ad5a0ab7405be9ffda0a9dd34580c6039f6bbb0301920fb2df0c31be3c72c58e", + 0 + }; +static u3j_core _140_qua__cold_d[] = + { { "fun", 7, _140_qua__cold_fun_a, 0, _140_qua__cold_fun_ha }, + {} + }; +static c3_c* _140_qua__cold_ha[] = { + "06c49d8dab6cb057e3ae1d1164e96950944ea48e54ad72347239ea434f1d4b9c", + 0 +}; + + static u3j_harm _140_qua__cook_fun_a[] = {{".2", u3we_cook_fun}, {}}; + static c3_c* _140_qua__cook_fun_ha[] = { + "f2a45612ad9c279b723334ab0915d3ed3ece7727309968c2555f45e0668eeb27", + 0 + }; +static u3j_core _140_qua__cook_d[] = + { { "fun", 7, _140_qua__cook_fun_a, 0, _140_qua__cook_fun_ha }, + {} + }; +static c3_c* _140_qua__cook_ha[] = { + "3ccd46dd21828d7be11f8c093536e305b1df982393a69c40ea73f63a574b3bb1", + 0 +}; + + static u3j_harm _140_qua__comp_fun_a[] = {{".2", u3we_comp_fun}, {}}; + static c3_c* _140_qua__comp_fun_ha[] = { + "bd7fdba84b05b00a63c24d19a03b882578ee9a3b922a3a688f7827c6e64daf96", + 0 + }; +static u3j_core _140_qua__comp_d[] = + { { "fun", 7, _140_qua__comp_fun_a, 0, _140_qua__comp_fun_ha }, + {} + }; +static c3_c* _140_qua__comp_ha[] = { + "7baad25ba87bcbba8ce4fe328280a799765dcf62a8bb761ffd87b939dd8734f2", + 0 +}; + + static u3j_harm _140_qua__easy_fun_a[] = {{".2", u3we_easy_fun}, {}}; + static c3_c* _140_qua__easy_fun_ha[] = { + "4bbbc43ece463d961e572301d0824d3e3cab3ba09ec2756cbefae63ee106044b", + 0 + }; +static u3j_core _140_qua__easy_d[] = + { { "fun", 7, _140_qua__easy_fun_a, 0, _140_qua__easy_fun_ha }, + {} + }; +static c3_c* _140_qua__easy_ha[] = { + "fdcf833943e24323deb6b071497498933ce6c4ba7d4742f2752b6ddb7fb9634e", + 0 +}; + + static u3j_harm _140_qua__glue_fun_a[] = {{".2", u3we_glue_fun}, {}}; + static c3_c* _140_qua__glue_fun_ha[] = { + "ffe0fe8815a2298c51a58e963efbbb7af90830abf11ce50bf9a47f479ce452fb", + 0 + }; +static u3j_core _140_qua__glue_d[] = + { { "fun", 7, _140_qua__glue_fun_a, 0, _140_qua__glue_fun_ha }, + {} + }; +static c3_c* _140_qua__glue_ha[] = { + "079c8a395428c2921b266a84bcf271fbe62f3d873b26680661e13a78df1a3989", + 0 +}; + + static u3j_harm _140_qua__here_fun_a[] = {{".2", u3we_here_fun}, {}}; + static c3_c* _140_qua__here_fun_ha[] = { + "47ec445fcfa89d266dae3c3590ed041d1b05f92d1bce360f232da5d496e4f2eb", + 0 + }; +static u3j_core _140_qua__here_d[] = + { { "fun", 7, _140_qua__here_fun_a, 0, _140_qua__here_fun_ha }, + {} + }; +static c3_c* _140_qua__here_ha[] = { + "4600093be5becba9a65a14b67624e3d9e4c66e0c97ba57b2bc271907eea32ffe", + 0 +}; + + static u3j_harm _140_qua__just_fun_a[] = {{".2", u3we_just_fun}, {}}; + static c3_c* _140_qua__just_fun_ha[] = { + "38bf1fb843bc29837868f2828f32d7e2bbb419b0cb9a1236adea28dfc6ce1040", + 0 + }; +static u3j_core _140_qua__just_d[] = + { { "fun", 7, _140_qua__just_fun_a, 0, _140_qua__just_fun_ha }, + {} + }; +static c3_c* _140_qua__just_ha[] = { + "7d6b2165e52dec478d96cf72478a35b7a92b014e6a15f046f026c0c8cb07679b", + 0 +}; + + static u3j_harm _140_qua__mask_fun_a[] = {{".2", u3we_mask_fun}, {}}; + static c3_c* _140_qua__mask_fun_ha[] = { + "892dfcd5f3d90981fa6e7608e93f0517000d316e7d9c07b3bd390c4966c97f5f", + 0 + }; +static u3j_core _140_qua__mask_d[] = + { { "fun", 7, _140_qua__mask_fun_a, 0, _140_qua__mask_fun_ha }, + {} + }; +static c3_c* _140_qua__mask_ha[] = { + "48e11fc12d7c453cda6ca42577d68e968446aa4d0ad3b99cc674affc7f4507b4", + 0 +}; + + static u3j_harm _140_qua__shim_fun_a[] = {{".2", u3we_shim_fun}, {}}; + static c3_c* _140_qua__shim_fun_ha[] = { + "4e26a0e98adb13ee6718fd68d90910c630df9bb7023b3e3ef40cda6710075fc9", + 0 + }; +static u3j_core _140_qua__shim_d[] = + { { "fun", 7, _140_qua__shim_fun_a, 0, _140_qua__shim_fun_ha }, + {} + }; +static c3_c* _140_qua__shim_ha[] = { + "226b96d1a59daada23a1ea80227c2dbf32ddd748d4c6363f316147ab7f292ced", + 0 +}; + + static u3j_harm _140_qua__stag_fun_a[] = {{".2", u3we_stag_fun}, {}}; + static c3_c* _140_qua__stag_fun_ha[] = { + "f76c7205c23e77809af793bc506f4727071fd029d234317fe78a7f65e2b7d6ea", + 0 + }; +static u3j_core _140_qua__stag_d[] = + { { "fun", 7, _140_qua__stag_fun_a, 0, _140_qua__stag_fun_ha }, + {} + }; +static c3_c* _140_qua__stag_ha[] = { + "fc978af18fb13dc0d77501b6f3eeb538b079b4345eb9195c3dd44c516e69424a", + 0 +}; + + static u3j_harm _140_qua__stew_fun_a[] = {{".2", u3we_stew_fun}, {}}; + static c3_c* _140_qua__stew_fun_ha[] = { + "a700f6bdfdb83ba33b2a3fe92fda3cb1bbfe95e595401538c8371b55fcc61447", + 0 + }; +static u3j_core _140_qua__stew_d[] = + { { "fun", 31, _140_qua__stew_fun_a, 0, _140_qua__stew_fun_ha }, + {} + }; +static c3_c* _140_qua__stew_ha[] = { + "29303fd6ab78cbbccdfc5bcf23d0bff126a0ef2bf4fa11ce70fcf4e6aa5fe60b", + 0 +}; + + static u3j_harm _140_qua__stir_fun_a[] = {{".2", u3we_stir_fun}, {}}; + static c3_c* _140_qua__stir_fun_ha[] = { + "6251308ea3c741e76ef9cb2dc5a71c9d8706d6cce6fdb420fef12915e0c032d6", + 0 + }; +static u3j_core _140_qua__stir_d[] = + { { "fun", 7, _140_qua__stir_fun_a, 0, _140_qua__stir_fun_ha }, + {} + }; +static c3_c* _140_qua__stir_ha[] = { + "4e466aef4d91f0ced008c00e8a4330afb3a43ef81dc1a6d93f1853685f69b9ca", + 0 +}; + +static u3j_harm _140_qua_pfix_a[] = {{".2", u3we_pfix}, {}}; +static c3_c* _140_qua_pfix_ha[] = { + "f7019bccc8b3b04a969878ffed84c9eba4dfa60ee32f984119cacb0c2381656b", + 0 +}; + +static u3j_harm _140_qua_plug_a[] = {{".2", u3we_plug}, {}}; +static c3_c* _140_qua_plug_ha[] = { + "5f5a9824e0952fd565748cc0a20f96cf883a41e2f5707c8a7797e6edd617b79c", + 0 +}; +static u3j_harm _140_qua_pose_a[] = {{".2", u3we_pose}, {}}; +static c3_c* _140_qua_pose_ha[] = { + "5c77203f288ef0f7bcd87871c69673db7fc804b647ecc42992707dc32f0f4611", + 0 +}; + +static u3j_harm _140_qua_sfix_a[] = {{".2", u3we_sfix}, {}}; +static c3_c* _140_qua_sfix_ha[] = { + "00987ed37104b902c5264d4d013826d762bfa80a6b29cfe4b7fa61b1ddd9cfac", + 0 +}; + +static u3j_harm _140_qua_mink_a[] = {{".2", u3we_mink}, {}}; +static c3_c* _140_qua_mink_ha[] = { + "99b653da6a21fa3375424811af288f59164592ece4a072abc460df03e81abcaf", + 0 +}; +static u3j_harm _140_qua_mole_a[] = {{".2", u3we_mole}, {}}; +static c3_c* _140_qua_mole_ha[] = { + "029c1acaff1911c54ce31a3693397394604ea970bf076078c1a1cfa23d2fa74e", + 0 +}; +static u3j_harm _140_qua_mule_a[] = {{".2", u3we_mule}, {}}; +static c3_c* _140_qua_mule_ha[] = { + "d54688d726565ddade7f2636741cad7209ea40fab28d3335555d8a02ff6001c4", + 0 +}; + +static u3j_core _140_qua_d[] = +{ { "pen", 3, 0, _140_pen_d, _140_pen_ha, _140_pen_ho }, + + { "po", 7, 0, _140_qua__po_d, _140_qua__po_ha }, + + { "trip", 7, _140_qua_trip_a, 0, _140_qua_trip_ha }, + + { "bend", 7, 0, _140_qua__bend_d, _140_qua__bend_ha }, + { "cold", 7, 0, _140_qua__cold_d, _140_qua__cold_ha }, + { "comp", 7, 0, _140_qua__comp_d, _140_qua__comp_ha }, + { "cook", 7, 0, _140_qua__cook_d, _140_qua__cook_ha }, + { "easy", 7, 0, _140_qua__easy_d, _140_qua__easy_ha }, + { "glue", 7, 0, _140_qua__glue_d, _140_qua__glue_ha }, + { "here", 7, 0, _140_qua__here_d, _140_qua__here_ha }, + { "just", 7, 0, _140_qua__just_d, _140_qua__just_ha }, + { "mask", 7, 0, _140_qua__mask_d, _140_qua__mask_ha }, + { "shim", 7, 0, _140_qua__shim_d, _140_qua__shim_ha }, + { "stag", 7, 0, _140_qua__stag_d, _140_qua__stag_ha }, + { "stew", 7, 0, _140_qua__stew_d, _140_qua__stew_ha }, + { "stir", 7, 0, _140_qua__stir_d, _140_qua__stir_ha }, + + { "pfix", 7, _140_qua_pfix_a, 0, _140_qua_pfix_ha }, + { "plug", 7, _140_qua_plug_a, 0, _140_qua_plug_ha }, + { "pose", 7, _140_qua_pose_a, 0, _140_qua_pose_ha }, + { "sfix", 7, _140_qua_sfix_a, 0, _140_qua_sfix_ha }, + + { "mink", 7, _140_qua_mink_a, 0, _140_qua_mink_ha }, + { "mole", 7, _140_qua_mole_a, 0, _140_qua_mole_ha }, + { "mule", 7, _140_qua_mule_a, 0, _140_qua_mule_ha }, + + { "scot", 7, _140_qua_scot_a, 0, _140_qua_scot_ha }, + { "scow", 7, _140_qua_scow_a, 0, _140_qua_scow_ha }, + { "slaw", 7, _140_qua_slaw_a, 0, _140_qua_slaw_ha }, + {} +}; +static c3_c* _140_qua_ha[] = { + "db9b4b21c0a8a8324105cbccc1421ef2a715ef0562c280b943fe1d96651cd9cc", + 0 +}; + +static u3j_hood _140_qua_ho[] = { + { "mute", 0x2fbabe }, + { "show", 24406 }, + { "mure", 1404 }, + {}, +}; + + +/* layer three +*/ + static u3j_harm _140_tri__cofl__drg_a[] = {{".2", u3wef_drg}, {}}; + static c3_c* _140_tri__cofl__drg_ha[] = { + "6063adb8cac639f7b20d5e7700c8108266be04f99cce4434f906240b424bf36d", + 0 + }; + static u3j_harm _140_tri__cofl__lug_a[] = {{".2", u3wef_lug}, {}}; + static c3_c* _140_tri__cofl__lug_ha[] = { + "f146a84731447e5c4b1e7b6e9331b33d1babed09bb0618e134c9535062154a87", + 0 + }; +static u3j_core _140_tri__cofl_d[] = + { { "drg", 7, _140_tri__cofl__drg_a, 0, _140_tri__cofl__drg_ha }, + { "lug", 7, _140_tri__cofl__lug_a, 0, _140_tri__cofl__lug_ha }, + {} + }; +static c3_c* _140_tri__cofl_ha[] = { + "f320c5bf51db85f55b900f4160f7e0ab9ef267f43ddb698900de034c6e2600d5", + 0 +}; + + static u3j_harm _140_tri__rd_add_a[] = {{".2", u3wer_add}, {}}; + static c3_c* _140_tri__rd_add_ha[] = { + "90dfaaadb2878d6d89a808ce4199e5bb239fa981e1c2edf24dc54aa3fcab55a5", + 0 + }; + static u3j_harm _140_tri__rd_sub_a[] = {{".2", u3wer_sub}, {}}; + static c3_c* _140_tri__rd_sub_ha[] = { + "5898a2424ba815d66d83917953f01860e63207f4200a447f632d9a5cc77a8a9c", + 0 + }; + static u3j_harm _140_tri__rd_mul_a[] = {{".2", u3wer_mul}, {}}; + static c3_c* _140_tri__rd_mul_ha[] = { + "a3af44ef4cd89afe78f1088bddb7d56dfa7fc209153256557c98ff34b67976bc", + 0 + }; + static u3j_harm _140_tri__rd_div_a[] = {{".2", u3wer_div}, {}}; + static c3_c* _140_tri__rd_div_ha[] = { + "9be3b38b9b4b0b0cd0bb060529c8f439cb0589aa9c3528efc519fbcc6845e98d", + 0 + }; + static u3j_harm _140_tri__rd_sqt_a[] = {{".2", u3wer_sqt}, {}}; + static c3_c* _140_tri__rd_sqt_ha[] = { + "0413678ac8ec89c3425ba762cd24b2a8a455543ec9b5dd719524e6b834e0c99c", + 0 + }; + static u3j_harm _140_tri__rd_fma_a[] = {{".2", u3wer_fma}, {}}; + static c3_c* _140_tri__rd_fma_ha[] = { + "7c920238dd42fb645c057cc950ed7ece775d5f502a0faf6ef5d17d348e0fc3e3", + 0 + }; + static u3j_harm _140_tri__rd_lth_a[] = {{".2", u3wer_lth}, {}}; + static c3_c* _140_tri__rd_lth_ha[] = { + "a108f1ac15c1d4e2c86457c9afc97a97a5954003c709c3c19c722b37255bcba9", + 0 + }; + static u3j_harm _140_tri__rd_lte_a[] = {{".2", u3wer_lte}, {}}; + static c3_c* _140_tri__rd_lte_ha[] = { + "ef9a6b2c5cdd0d4de550a32679d242693131cdc3cf40ac914eadfa7d6d9f1bac", + 0 + }; + static u3j_harm _140_tri__rd_equ_a[] = {{".2", u3wer_equ}, {}}; + static c3_c* _140_tri__rd_equ_ha[] = { + "c93cdb951dca3b0ac61070780f95e1baa3718fe519d0268305c032cf14a21e39", + 0 + }; + static u3j_harm _140_tri__rd_gte_a[] = {{".2", u3wer_gte}, {}}; + static c3_c* _140_tri__rd_gte_ha[] = { + "6857077d97e2fc203b555dc20748c33d34b694d33c48f628543bea6491e722a6", + 0 + }; + static u3j_harm _140_tri__rd_gth_a[] = {{".2", u3wer_gth}, {}}; + static c3_c* _140_tri__rd_gth_ha[] = { + "87fd815913fa590c715d3a96ada5bae6298f3e7823af90ffcdf235f493c56330", + 0 + }; +static u3j_core _140_tri__rd_d[] = + { { "add", 7, _140_tri__rd_add_a, 0, _140_tri__rd_add_ha }, + { "sub", 7, _140_tri__rd_sub_a, 0, _140_tri__rd_sub_ha }, + { "mul", 7, _140_tri__rd_mul_a, 0, _140_tri__rd_mul_ha }, + { "div", 7, _140_tri__rd_div_a, 0, _140_tri__rd_div_ha }, + { "sqt", 7, _140_tri__rd_sqt_a, 0, _140_tri__rd_sqt_ha }, + { "fma", 7, _140_tri__rd_fma_a, 0, _140_tri__rd_fma_ha }, + { "lth", 7, _140_tri__rd_lth_a, 0, _140_tri__rd_lth_ha }, + { "lte", 7, _140_tri__rd_lte_a, 0, _140_tri__rd_lte_ha }, + { "equ", 7, _140_tri__rd_equ_a, 0, _140_tri__rd_equ_ha }, + { "gte", 7, _140_tri__rd_gte_a, 0, _140_tri__rd_gte_ha }, + { "gth", 7, _140_tri__rd_gth_a, 0, _140_tri__rd_gth_ha }, + {} + }; +static c3_c* _140_tri__rd_ha[] = { + "0afab285837f9c88faff3ac8f3f49b5e259da253e0505cd823a53d4e826261f7", + 0 +}; + + static u3j_harm _140_tri__rs_add_a[] = {{".2", u3wet_add}, {}}; + static c3_c* _140_tri__rs_add_ha[] = { + "b89a1e348628fd9b4fd520aabbf6c53e12be5bbf661b9094f7a9841be3f51de9", + 0 + }; + static u3j_harm _140_tri__rs_sub_a[] = {{".2", u3wet_sub}, {}}; + static c3_c* _140_tri__rs_sub_ha[] = { + "9d13b86d17908830f93b920e80e1a985105583597f6fb640f175c98052e357f1", + 0 + }; + static u3j_harm _140_tri__rs_mul_a[] = {{".2", u3wet_mul}, {}}; + static c3_c* _140_tri__rs_mul_ha[] = { + "5c61a9e335f6c139332523d871ca5773ab476365b623444370474fde08639061", + 0 + }; + static u3j_harm _140_tri__rs_div_a[] = {{".2", u3wet_div}, {}}; + static c3_c* _140_tri__rs_div_ha[] = { + "a7147a81be3ef5a1c0de6587edb2990e30057d7871d73632eabc8dc567e751c8", + 0 + }; + static u3j_harm _140_tri__rs_sqt_a[] = {{".2", u3wet_sqt}, {}}; + static c3_c* _140_tri__rs_sqt_ha[] = { + "c403bb48d78bcfa9cd4128b7f9eb362e71e5269ab6578fb0bb5e70b4244c5781", + 0 + }; + static u3j_harm _140_tri__rs_fma_a[] = {{".2", u3wet_fma}, {}}; + static c3_c* _140_tri__rs_fma_ha[] = { + "afc14914eb8f579a0c6620db69bc951329325747a8ef01c2d0e5feb29e9a9ddd", + 0 + }; + static u3j_harm _140_tri__rs_lth_a[] = {{".2", u3wet_lth}, {}}; + static c3_c* _140_tri__rs_lth_ha[] = { + "e7efa422def6b6dbd25b5f664462adb3895b8b45f9531877c9dbfe40a96612bf", + 0 + }; + static u3j_harm _140_tri__rs_lte_a[] = {{".2", u3wet_lte}, {}}; + static c3_c* _140_tri__rs_lte_ha[] = { + "b45e1ef16c47dc9b99865c7e75d4c2094c0e206ed538818a38da0adb7fbe2ce3", + 0 + }; + static u3j_harm _140_tri__rs_equ_a[] = {{".2", u3wet_equ}, {}}; + static c3_c* _140_tri__rs_equ_ha[] = { + "8c1178311ded837292c297380e48cf7e0bc4d83962dadcafda0c9ef9f20e39f2", + 0 + }; + static u3j_harm _140_tri__rs_gte_a[] = {{".2", u3wet_gte}, {}}; + static c3_c* _140_tri__rs_gte_ha[] = { + "50f5eb237b74e772eb6a3257441078461450cd4a25cf9bd97cb1a5e00f4ff4d2", + 0 + }; + static u3j_harm _140_tri__rs_gth_a[] = {{".2", u3wet_gth}, {}}; + static c3_c* _140_tri__rs_gth_ha[] = { + "505842ff486f0bb8fa63f04d2fd6f806dc760f9b4a12a3bf2d57da92f560785b", + 0 + }; +static u3j_core _140_tri__rs_d[] = + { { "add", 7, _140_tri__rs_add_a, 0, _140_tri__rs_add_ha }, + { "sub", 7, _140_tri__rs_sub_a, 0, _140_tri__rs_sub_ha }, + { "mul", 7, _140_tri__rs_mul_a, 0, _140_tri__rs_mul_ha }, + { "div", 7, _140_tri__rs_div_a, 0, _140_tri__rs_div_ha }, + { "sqt", 7, _140_tri__rs_sqt_a, 0, _140_tri__rs_sqt_ha }, + { "fma", 7, _140_tri__rs_fma_a, 0, _140_tri__rs_fma_ha }, + { "lth", 7, _140_tri__rs_lth_a, 0, _140_tri__rs_lth_ha }, + { "lte", 7, _140_tri__rs_lte_a, 0, _140_tri__rs_lte_ha }, + { "equ", 7, _140_tri__rs_equ_a, 0, _140_tri__rs_equ_ha }, + { "gte", 7, _140_tri__rs_gte_a, 0, _140_tri__rs_gte_ha }, + { "gth", 7, _140_tri__rs_gth_a, 0, _140_tri__rs_gth_ha }, + {} + }; +static c3_c* _140_tri__rs_ha[] = { + "6c7027c5de34540a4b1548039e5423fb44727079af054b7135a3e961ec8dede8", + 0 +}; + + static u3j_harm _140_tri__rq_add_a[] = {{".2", u3weq_add}, {}}; + static c3_c* _140_tri__rq_add_ha[] = { + "9c4c2a37550930605495401886d41fb9fbc2eba487e0ba845130fe88e4c52a01", + 0 + }; + static u3j_harm _140_tri__rq_sub_a[] = {{".2", u3weq_sub}, {}}; + static c3_c* _140_tri__rq_sub_ha[] = { + "f3b027090a1bb5af74234301facfbf64503b3e0599501ade12cb05aa158a79a3", + 0 + }; + static u3j_harm _140_tri__rq_mul_a[] = {{".2", u3weq_mul}, {}}; + static c3_c* _140_tri__rq_mul_ha[] = { + "15c03b1f3081514c4767d86297aaebf1d62af7f3437f30821f011b17ed769f3a", + 0 + }; + static u3j_harm _140_tri__rq_div_a[] = {{".2", u3weq_div}, {}}; + static c3_c* _140_tri__rq_div_ha[] = { + "094105c77e37e548ea1b8d49a132ab97d90a0ab5f329340400c381bcd44de347", + 0 + }; + static u3j_harm _140_tri__rq_sqt_a[] = {{".2", u3weq_sqt}, {}}; + static c3_c* _140_tri__rq_sqt_ha[] = { + "a031cd5b8e05f997323b0ca1ca9d2419401d7d2acc2da6fc6387fe57701b84b0", + 0 + }; + static u3j_harm _140_tri__rq_fma_a[] = {{".2", u3weq_fma}, {}}; + static c3_c* _140_tri__rq_fma_ha[] = { + "871664a9305808a671aacf1de0e83f8e951611033170d86370352afb363b79bc", + 0 + }; + static u3j_harm _140_tri__rq_lth_a[] = {{".2", u3weq_lth}, {}}; + static c3_c* _140_tri__rq_lth_ha[] = { + "b10822caa442c8e9f6b9eb52aac5796a42bed5ae0eef7fe49d4075b38bf78ddd", + 0 + }; + static u3j_harm _140_tri__rq_lte_a[] = {{".2", u3weq_lte}, {}}; + static c3_c* _140_tri__rq_lte_ha[] = { + "3316346be3e9464fbb5b0feff16cd2252086004229d08f8eaa320f9509d6a029", + 0 + }; + static u3j_harm _140_tri__rq_equ_a[] = {{".2", u3weq_equ}, {}}; + static c3_c* _140_tri__rq_equ_ha[] = { + "154be82a7b8ecf4571015d9ef6c0e90ffd8c3e8803441d9c2df5a4ea484ccf3b", + 0 + }; + static u3j_harm _140_tri__rq_gte_a[] = {{".2", u3weq_gte}, {}}; + static c3_c* _140_tri__rq_gte_ha[] = { + "edbe94f9cfefa89deef7f6c11f4ce8240fd93970dbd6130e632d0447452a612a", + 0 + }; + static u3j_harm _140_tri__rq_gth_a[] = {{".2", u3weq_gth}, {}}; + static c3_c* _140_tri__rq_gth_ha[] = { + "50e85936cfad61659ed1bfdab26fda2b2696571b9aa4b4c55dc5c0d919edc296", + 0 + }; +static u3j_core _140_tri__rq_d[] = + { { "add", 7, _140_tri__rq_add_a, 0, _140_tri__rq_add_ha }, + { "sub", 7, _140_tri__rq_sub_a, 0, _140_tri__rq_sub_ha }, + { "mul", 7, _140_tri__rq_mul_a, 0, _140_tri__rq_mul_ha }, + { "div", 7, _140_tri__rq_div_a, 0, _140_tri__rq_div_ha }, + { "sqt", 7, _140_tri__rq_sqt_a, 0, _140_tri__rq_sqt_ha }, + { "fma", 7, _140_tri__rq_fma_a, 0, _140_tri__rq_fma_ha }, + { "lth", 7, _140_tri__rq_lth_a, 0, _140_tri__rq_lth_ha }, + { "lte", 7, _140_tri__rq_lte_a, 0, _140_tri__rq_lte_ha }, + { "equ", 7, _140_tri__rq_equ_a, 0, _140_tri__rq_equ_ha }, + { "gte", 7, _140_tri__rq_gte_a, 0, _140_tri__rq_gte_ha }, + { "gth", 7, _140_tri__rq_gth_a, 0, _140_tri__rq_gth_ha }, + {} + }; +static c3_c* _140_tri__rq_ha[] = { + "b772cd5901a18dc91852fada74c2a1e4b1bbf4e7465451b0d8bdcc86d2288c22", + 0 +}; + + static u3j_harm _140_tri__rh_add_a[] = {{".2", u3wes_add}, {}}; + static c3_c* _140_tri__rh_add_ha[] = { + "7e2b600eced08d774800a6a3d82e18189db85010b870c26905ee38008d3d301e", + 0 + }; + static u3j_harm _140_tri__rh_sub_a[] = {{".2", u3wes_sub}, {}}; + static c3_c* _140_tri__rh_sub_ha[] = { + "827dfb41660cb4743a88d921b4185bd2000ee6f0708ec36ac8aba2e4e19c0875", + 0 + }; + static u3j_harm _140_tri__rh_mul_a[] = {{".2", u3wes_mul}, {}}; + static c3_c* _140_tri__rh_mul_ha[] = { + "ec2a010128aca0a6f74196f3de4fe7b6617fd810d3b19f7bf5878afb787e8b86", + 0 + }; + static u3j_harm _140_tri__rh_div_a[] = {{".2", u3wes_div}, {}}; + static c3_c* _140_tri__rh_div_ha[] = { + "067a3dafb0158bc2441729beb2c0934c6c6ccf0a9b5193db9c16f22b490b27c6", + 0 + }; + static u3j_harm _140_tri__rh_sqt_a[] = {{".2", u3wes_sqt}, {}}; + static c3_c* _140_tri__rh_sqt_ha[] = { + "3fdbba47626d91d41fcdf460ad38018c78b0233d7ec4d0fac406a8c5357a2384", + 0 + }; + static u3j_harm _140_tri__rh_fma_a[] = {{".2", u3wes_fma}, {}}; + static c3_c* _140_tri__rh_fma_ha[] = { + "ada2adf5a88ba61759219926aef950e72ae6926c6e10c30ecd0f9c99e79beca0", + 0 + }; + static u3j_harm _140_tri__rh_lth_a[] = {{".2", u3wes_lth}, {}}; + static c3_c* _140_tri__rh_lth_ha[] = { + "70c9bc0073d23371d8155c28795f5acbff1a9504a5a3881c8693aa7c1f3d35d4", + 0 + }; + static u3j_harm _140_tri__rh_lte_a[] = {{".2", u3wes_lte}, {}}; + static c3_c* _140_tri__rh_lte_ha[] = { + "6157e766050f9697c05b111ad2a582459a63a98b3b1ec70881f9ad943f951a0d", + 0 + }; + static u3j_harm _140_tri__rh_equ_a[] = {{".2", u3wes_equ}, {}}; + static c3_c* _140_tri__rh_equ_ha[] = { + "72664392e2a00137383aa5a55e947c5e95c7b3172f71a7238dc0d55050196884", + 0 + }; + static u3j_harm _140_tri__rh_gte_a[] = {{".2", u3wes_gte}, {}}; + static c3_c* _140_tri__rh_gte_ha[] = { + "145355b13712b9471031e755d0ab271907efdb9a287b1bacb2f1d0338d28dbf6", + 0 + }; + static u3j_harm _140_tri__rh_gth_a[] = {{".2", u3wes_gth}, {}}; + static c3_c* _140_tri__rh_gth_ha[] = { + "d53219ee10acdd291a1e2b34fa5f543c780a0301357e93cfebd466e556f9824e", + 0 + }; +static u3j_core _140_tri__rh_d[] = + { { "add", 7, _140_tri__rh_add_a, 0, _140_tri__rh_add_ha }, + { "sub", 7, _140_tri__rh_sub_a, 0, _140_tri__rh_sub_ha }, + { "mul", 7, _140_tri__rh_mul_a, 0, _140_tri__rh_mul_ha }, + { "div", 7, _140_tri__rh_div_a, 0, _140_tri__rh_div_ha }, + { "sqt", 7, _140_tri__rh_sqt_a, 0, _140_tri__rh_sqt_ha }, + { "fma", 7, _140_tri__rh_fma_a, 0, _140_tri__rh_fma_ha }, + { "lth", 7, _140_tri__rh_lth_a, 0, _140_tri__rh_lth_ha }, + { "lte", 7, _140_tri__rh_lte_a, 0, _140_tri__rh_lte_ha }, + { "equ", 7, _140_tri__rh_equ_a, 0, _140_tri__rh_equ_ha }, + { "gte", 7, _140_tri__rh_gte_a, 0, _140_tri__rh_gte_ha }, + { "gth", 7, _140_tri__rh_gth_a, 0, _140_tri__rh_gth_ha }, + {} + }; +static c3_c* _140_tri__rh_ha[] = { + "c38f8c0a7e2f1fccb52c459f60a30ec5d21635cafaf1aa120b70c1fa91cf7da5", + 0 +}; + + static u3j_harm _140_tri__og_raw_a[] = {{".2", u3weo_raw}, {}}; + static c3_c* _140_tri__og_raw_ha[] = { + "bbcbefc237dbebf6c141ba14fd9e0464a836127fd123d10da5f121e82d49ebdb", + 0 + }; +static u3j_core _140_tri__og_d[] = + { { "raw", 7, _140_tri__og_raw_a, 0, _140_tri__og_raw_ha }, + {} + }; +static c3_c* _140_tri__og_ha[] = { + "74b9ae67eeabbffcff969ac7fdc7f4f0f4f67af64931e969bcac50d084e15fc0", + 0 +}; + + static u3j_harm _140_tri__sha_sha1_a[] = {{".2", u3we_sha1}, {}}; + static c3_c* _140_tri__sha_sha1_ha[] = { + "75aababa0688619d9df36238269119302a64ad2e3c69c53bd0057fe6b1abaf0c", + 0 + }; +static u3j_core _140_tri__sha_d[] = + { { "sha1", 7, _140_tri__sha_sha1_a, 0, _140_tri__sha_sha1_ha }, + {} + }; +static c3_c* _140_tri__sha_ha[] = { + "3c22d2f8719cb626e8dfe1a4206bcbc14b678c1422c48322054b40f84416d557", + 0 +}; + +static u3j_harm _140_tri_shax_a[] = {{".2", u3we_shax}, {}}; +static c3_c* _140_tri_shax_ha[] = { + "0fc53de3ddc8b8f84a46136f1728fa3ed66a5113888d14907589d16bf5927ad8", + 0 +}; +static u3j_harm _140_tri_shay_a[] = {{".2", u3we_shay}, {}}; +static c3_c* _140_tri_shay_ha[] = { + "b6dbc72e15c2204f83f902619b7a60328f29c9d302ddb35c435111dea28c5470", + 0 +}; +static u3j_harm _140_tri_shas_a[] = {{".2", u3we_shas}, {}}; +static c3_c* _140_tri_shas_ha[] = { + "5230583767b7625b3496248ed03b6b94c1d4ee9b26342f9390bf999ec9b6cfdb", + 0 +}; +static u3j_harm _140_tri_shal_a[] = {{".2", u3we_shal}, {}}; +static c3_c* _140_tri_shal_ha[] = { + "3242912e29e3e1ed8d1a395cc860a82d78961b4278ed79bbdeb37cb5615bbf20", + 0 +}; + + static u3j_harm _140_ob_fein_a[] = {{".2", u3we_fein_ob}, {}}; + static c3_c* _140_ob_fein_ha[] = { + 0 + }; + static u3j_harm _140_ob_fynd_a[] = {{".2", u3we_fynd_ob}, {}}; + static c3_c* _140_ob_fynd_ha[] = { + 0 + }; +static u3j_core _140_ob_d[] = { + { "fein", 7, _140_ob_fein_a, 0, _140_ob_fein_ha }, + { "fynd", 7, _140_ob_fynd_a, 0, _140_ob_fynd_ha }, + {} +}; +static c3_c* _140_ob_ha[] = { + "13ebfbdee69396bc1d980fc4dcbcdaa9cc3fb9c011e6cf188e71311a8bffc8e6", + 0 +}; +static u3j_hood _140_ob_ho[] = { + { "fein", 42 }, + { "fynd", 20 }, + {}, +}; + +static u3j_core _140_tri_d[] = +{ { "qua", 3, 0, _140_qua_d, _140_qua_ha, _140_qua_ho }, + + { "cofl", 7, 0, _140_tri__cofl_d, _140_tri__cofl_ha }, + { "rd", 7, 0, _140_tri__rd_d, _140_tri__rd_ha }, + { "rs", 7, 0, _140_tri__rs_d, _140_tri__rs_ha }, + { "rq", 7, 0, _140_tri__rq_d, _140_tri__rq_ha }, + { "rh", 7, 0, _140_tri__rh_d, _140_tri__rh_ha }, + { "og", 7, 0, _140_tri__og_d, _140_tri__og_ha }, + + { "sha", 7, 0, _140_tri__sha_d, _140_tri__sha_ha }, + { "shax", 7, _140_tri_shax_a, 0, _140_tri_shax_ha }, + { "shay", 7, _140_tri_shay_a, 0, _140_tri_shay_ha }, + { "shas", 7, _140_tri_shas_a, 0, _140_tri_shas_ha }, + { "shal", 7, _140_tri_shal_a, 0, _140_tri_shal_ha }, + + { "ob", 3, 0, _140_ob_d, _140_ob_ha, _140_ob_ho }, + {} +}; +static c3_c* _140_tri_ha[] = { + "e7339eb317038f64555717c5624e4571fe9654d471c1a78454129afdbcad9b53", + 0 +}; + +static u3j_hood _140_tri_ho[] = { + { "ob", 20 }, + { "yore", 5462 }, + { "year", 44975 }, + {}, +}; + + +/* layer two +*/ +static u3j_harm _140_two_find_a[] = {{".2", u3wb_find, c3y}, {}}; +static c3_c* _140_two_find_ha[] = { + "cab18d537962b48d38fa061844f44c4635ee11c74fdf403aa80d3a6d1b15c177", + 0 +}; +static u3j_harm _140_two_flop_a[] = {{".2", u3wb_flop, c3y}, {}}; +static c3_c* _140_two_flop_ha[] = { + "73d496aac2ce6fd9475645c76f949ae0228f8f5ae6738529b08ed9aeb58255fe", + 0 +}; +static u3j_harm _140_two_lent_a[] = {{".2", u3wb_lent, c3y}, {}}; +static c3_c* _140_two_lent_ha[] = { + "1b98ab19350f6a6753ea4bd6daf4509a7c5681b7ac20c83204fe62846d46c2c3", + 0 +}; +static u3j_harm _140_two_levy_a[] = {{".2", u3wb_levy, c3y}, {}}; +static c3_c* _140_two_levy_ha[] = { + "634f1f506b17b4b50e6902f6e21b290ffc5305d1546075cba745c9e195fcc56b", + 0 +}; +static u3j_harm _140_two_lien_a[] = {{".2", u3wb_lien, c3y}, {}}; +static c3_c* _140_two_lien_ha[] = { + "2ffb70864f2be120b48869b27c614aadeed1390bde497d8940fe85b7861093ea", + 0 +}; +static u3j_harm _140_two_murn_a[] = {{".2", u3wb_murn, c3y}, {}}; +static c3_c* _140_two_murn_ha[] = { + "53257aaee131c2a892529c2ee75271160811814086456e8fdf249eebdf31b990", + 0 +}; +static u3j_harm _140_two_need_a[] = {{".2", u3wb_need, c3y}, {}}; +static c3_c* _140_two_need_ha[] = { + "bfdd39af478811efe816e69e8c9202d10c41f646c0d27f39c23e4fe1aec807dd", + 0 +}; +static u3j_harm _140_two_reap_a[] = {{".2", u3wb_reap, c3y}, {}}; +static c3_c* _140_two_reap_ha[] = { + "cf6bd10b97b418b67c645374712c768d9e7e9809c14ecf36a5c507e5fc4b4039", + 0 +}; +static u3j_harm _140_two_reel_a[] = {{".2", u3wb_reel, c3y}, {}}; +static c3_c* _140_two_reel_ha[] = { + "36108d1ba09617cf62e739e0ff2dcf9286f322ca0e8faa3521ef127e9840eebf", + 0 +}; +static u3j_harm _140_two_roll_a[] = {{".2", u3wb_roll, c3y}, {}}; +static c3_c* _140_two_roll_ha[] = { + "42abc6b3defd7c5eb8f6d14d57a14ba2a02d559907c03141c70a65e0803c01e5", + 0 +}; +static u3j_harm _140_two_skid_a[] = {{".2", u3wb_skid, c3y}, {}}; +static c3_c* _140_two_skid_ha[] = { + "832366432a85005f9a9849d6de9a9045c8f9a591050519b06aec6a9a1a54c360", + 0 +}; +static u3j_harm _140_two_skim_a[] = {{".2", u3wb_skim, c3y}, {}}; +static c3_c* _140_two_skim_ha[] = { + "ccbecb459b90d05ed6c1073859a58987bf9a479820b5550fa75f37b95f98a279", + 0 +}; +static u3j_harm _140_two_skip_a[] = {{".2", u3wb_skip, c3y}, {}}; +static c3_c* _140_two_skip_ha[] = { + "873e3e4d6b8f16212911aa982065dd0d36b1f6e8834828d5eb5d59afa9da2384", + 0 +}; +static u3j_harm _140_two_scag_a[] = {{".2", u3wb_scag, c3y}, {}}; +static c3_c* _140_two_scag_ha[] = { + "ddba868a28eb9655c9f6e06cfecb4ec9e9ff78277290579b9bb9b25339bb4ab9", + 0 +}; +static u3j_harm _140_two_slag_a[] = {{".2", u3wb_slag, c3y}, {}}; +static c3_c* _140_two_slag_ha[] = { + "811f7f67de7ab3f33b85198a69b1bf344498cd4922b0273d918a48b803b7877d", + 0 +}; +static u3j_harm _140_two_snag_a[] = {{".2", u3wb_snag, c3y}, {}}; +static c3_c* _140_two_snag_ha[] = { + "12a1d53541d4df9be60bda45f2dae6c6e6381f85edd4de062af23c6654860591", + 0 +}; +static u3j_harm _140_two_sort_a[] = {{".2", u3wb_sort, c3y}, {}}; +static c3_c* _140_two_sort_ha[] = { + "dc14f91fdedacd3b77bdf241d22555fe2bf0a231e9cab58b4ae779791e54c4e7", + 0 +}; +static u3j_harm _140_two_turn_a[] = {{".2", u3wb_turn, c3y}, {}}; +static c3_c* _140_two_turn_ha[] = { + "e13d9f52434ba810e182017f50a73d4d44eaa298a833231e90353f2a32ea6a78", + 0 +}; +static u3j_harm _140_two_weld_a[] = {{".2", u3wb_weld, c3y}, {}}; +static c3_c* _140_two_weld_ha[] = { + "d855628821d57392f575c5da000c7326eaaa19e08cda967a4772859269669df2", + 0 +}; +static u3j_harm _140_two_welp_a[] = {{".2", u3wb_welp, c3y}, {}}; +static c3_c* _140_two_welp_ha[] = { + "0bccae6625e62ce622c62f9e828a2a6469e2fbf42342d95e23c3b926f340140d", + 0 +}; +static u3j_harm _140_two_zing_a[] = {{".2", u3wb_zing, c3y}, {}}; +static c3_c* _140_two_zing_ha[] = { + "113bdea043e9e05cf4a63dac793caf34634bc58414d00250af87139405521b9d", + 0 +}; + +static u3j_harm _140_two_bex_a[] = {{".2", u3wc_bex, c3y}, {}}; +static c3_c* _140_two_bex_ha[] = { + "ee7a095ea21b6438ec19ab235e73877b96108f0a14cae02cecbd8a48c44e70e3", + 0 +}; +static u3j_harm _140_two_can_a[] = {{".2", u3wc_can, c3y}, {}}; +static c3_c* _140_two_can_ha[] = { + "c49ee52487369ba17a0105a61aa658df60e7a537e3e8737ab582644fe00b3938", + 0 +}; +static u3j_harm _140_two_cat_a[] = {{".2", u3wc_cat, c3y}, {}}; +static c3_c* _140_two_cat_ha[] = { + "467f007931110ac0755dcd44c5aaee65785a63b9042b8eea6a7838fa86cc5d8f", + 0 +}; +static u3j_harm _140_two_con_a[] = {{".2", u3wc_con, c3y}, {}}; +static c3_c* _140_two_con_ha[] = { + "d20f091bd4f28d37c1a78373df939f3d3a41e025129e9a2bb5e2b9a710358965", + 0 +}; +static u3j_harm _140_two_cut_a[] = {{".2", u3wc_cut, c3y}, {}}; +static c3_c* _140_two_cut_ha[] = { + "96bb4e9a259d6a1ede5461956b6a6fb73f05cb8e745c4803c2bae4ec0b7f0800", + 0 +}; +static u3j_harm _140_two_dis_a[] = {{".2", u3wc_dis, c3y}, {}}; +static c3_c* _140_two_dis_ha[] = { + "4b3987314451e20a45d2c7baff51d5d39be57e5970f23f86df4dd6569826ddff", + 0 +}; +static u3j_harm _140_two_dor_a[] = {{".2", u3wc_dor, c3y}, {}}; +static c3_c* _140_two_dor_ha[] = { + "277927a2e49e4d942e81ffc7740a71e68a7b732df886a9f84dc7d914be911879", + 0 +}; +static u3j_harm _140_two_end_a[] = {{".2", u3wc_end, c3y}, {}}; +static c3_c* _140_two_end_ha[] = { + "403c9f12f2481966ffb07842006713149960c67c6bcad8edd78cdf837bc0d854", + 0 +}; +static u3j_harm _140_two_gor_a[] = {{".2", u3wc_gor, c3y}, {}}; +static c3_c* _140_two_gor_ha[] = { + "8a1e3ed1de749ff2ff61d489466df618e4e0773498cb9693ec2e612e9733385c", + 0 +}; +static u3j_harm _140_two_lsh_a[] = {{".2", u3wc_lsh, c3y}, {}}; +static c3_c* _140_two_lsh_ha[] = { + "3db89b02bc596a57c7fb72a991c9fbf3197de501c56b3d1df26911b664c45f3d", + 0 +}; +static u3j_harm _140_two_met_a[] = {{".2", u3wc_met, c3y}, {}}; +static c3_c* _140_two_met_ha[] = { + "39dc9b1d10d9e93414b43f315f9a375596c99b4e8172d71d26759996bb7bab08", + 0 +}; +static u3j_harm _140_two_mix_a[] = {{".2", u3wc_mix, c3y}, {}}; +static c3_c* _140_two_mix_ha[] = { + "c84b3e487850d73dd5e4af18fb54b623028be3c45ae9b712718754233057fbc3", + 0 +}; +static u3j_harm _140_two_mor_a[] = {{".2", u3wc_mor, c3y}, {}}; +static c3_c* _140_two_mor_ha[] = { + "7c2d86e952606e571e5bcd988e70ded072c0eaa45d1fd958849d76360a763ddf", + 0 +}; +static u3j_harm _140_two_mug_a[] = {{".2", u3wc_mug, c3y}, {}}; +static c3_c* _140_two_mug_ha[] = { + "6da3f3aa1e951ef2d00e5131945d140fb52728558867237891e029160b7f5010", + 0 +}; +static u3j_harm _140_two_muk_a[] = {{".2", u3wc_muk, c3y}, {}}; +static c3_c* _140_two_muk_ha[] = { + "5a04a09bf7d22c8ef048ba2cc86be8f3a02066eab84cf4a45bbdf2bf534ff9f6", + 0 +}; +static u3j_harm _140_two_pow_a[] = {{".2", u3wc_pow, c3y}, {}}; +static c3_c* _140_two_pow_ha[] = { + "6cfcb9da6ad812eb72788e22e1370b4ab1b6ab64ab0628dfdff78ccead325406", + 0 +}; +static u3j_harm _140_two_rap_a[] = {{".2", u3wc_rap, c3y}, {}}; +static c3_c* _140_two_rap_ha[] = { + "f694f96bcbf97b339285d6c73ed5d33d112b911f7a991acefdef223ff01d8834", + 0 +}; +static u3j_harm _140_two_rep_a[] = {{".2", u3wc_rep, c3y}, {}}; +static c3_c* _140_two_rep_ha[] = { + "25aa2f1746e1cf2235117f22a3db152fa86e003d9bf9f9cfcda79e76e51f382f", + 0 +}; +static u3j_harm _140_two_rev_a[] = {{".2", u3wc_rev, c3y}, {}}; +static c3_c* _140_two_rev_ha[] = { + "15e20592ac1d9c0c80d99589e67cadb4ed7566be1d21844bbe7ef936e0db4524", + 0 +}; +static u3j_harm _140_two_rip_a[] = {{".2", u3wc_rip, c3y}, {}}; +static c3_c* _140_two_rip_ha[] = { + "16026c27499953978f69dbf81c1530b2dec8d5a2403c5561f7a5afcc180e129e", + 0 +}; +static u3j_harm _140_two_rsh_a[] = {{".2", u3wc_rsh, c3y}, {}}; +static c3_c* _140_two_rsh_ha[] = { + "55bd777f239a2a7c849e0c7a35bb967b79279c79bbd985f31ba272761f97928f", + 0 +}; +static u3j_harm _140_two_swp_a[] = {{".2", u3wc_swp, c3y}, {}}; +static c3_c* _140_two_swp_ha[] = { + "2c4583c36d73c9c2857052b893b87e1170a794e0edbbdba9d767ba7639e7c1ec", + 0 +}; +static u3j_harm _140_two_sqt_a[] = {{".2", u3wc_sqt, c3y}, {}}; +static c3_c* _140_two_sqt_ha[] = { + "fc28ff327ae69f55ccf257b69a1477b845552ef9e615e85718902c249bdeca6f", + 0 +}; +static u3j_harm _140_two_xeb_a[] = {{".2", u3wc_xeb, c3y}, {}}; +static c3_c* _140_two_xeb_ha[] = { + "41403aafe1e2ccb1a02edde96fe742085feffe028d02529eb2b13f925884a499", + 0 +}; + + static u3j_harm _140_two__in_apt_a[] = {{".2", u3wdi_apt_140}, {}}; + static c3_c* _140_two__in_apt_ha[] = { + "a40812fa255f13afdaf196bff38d2d9bfcb38f09c48ace9139a2701a555a0c9a", + 0 + }; + static u3j_harm _140_two__in_bif_a[] = {{".2", u3wdi_bif}, {}}; + static c3_c* _140_two__in_bif_ha[] = { + "edd0d727b9099e75c3e5b73b3025ad9737136eacedc2f8088b6edb02dbe06cb3", + 0 + }; + static u3j_harm _140_two__in_del_a[] = {{".2", u3wdi_del}, {}}; + static c3_c* _140_two__in_del_ha[] = { + "33a21e7aaf71105e2d48e1af61ff463fb8a0b7e04f8a8c30a6f6a2d1f967795f", + 0 + }; + static u3j_harm _140_two__in_dif_a[] = {{".2", u3wdi_dif}, {}}; + static c3_c* _140_two__in_dif_ha[] = { + "a488f0be5adbb1c04e2038a2315ac065591e7daadcafc1d47aea272979680468", + 0 + }; + static u3j_harm _140_two__in_gas_a[] = {{".2", u3wdi_gas}, {}}; + static c3_c* _140_two__in_gas_ha[] = { + "223a60a43a10f1f90a3b205ecfce8e17af1adfcf9dbf3cff9b8b1362656b1af1", + 0 + }; + static u3j_harm _140_two__in_has_a[] = {{".2", u3wdi_has}, {}}; + static c3_c* _140_two__in_has_ha[] = { + "a65e666e92176401040a883801e4f05bd650fe6c094a6c8d7f4afcaee9cf55ad", + 0 + }; + static u3j_harm _140_two__in_int_a[] = {{".2", u3wdi_int}, {}}; + static c3_c* _140_two__in_int_ha[] = { + "a71b0e355fa02d18447c02922f69096f42043da451e8c79e7a9270460c3a44e6", + 0 + }; + static u3j_harm _140_two__in_put_a[] = {{".2", u3wdi_put}, {}}; + static c3_c* _140_two__in_put_ha[] = { + "19b27267e18ef156d85d84d37e02692a17fec0b7a2a0fe4120a3ae02b841c8f4", + 0 + }; + static u3j_harm _140_two__in_rep_a[] = {{".2", u3wdi_rep}, {}}; + static c3_c* _140_two__in_rep_ha[] = { + "05bfb84a52ed8ccc330a96faca29a49afd28300960ac089d00dba32212b971a7", + 0 + }; + static u3j_harm _140_two__in_run_a[] = {{".2", u3wdi_run}, {}}; + static c3_c* _140_two__in_run_ha[] = { + "7f2061dbee19fa20925bd5a80cc41ed71e462e0f49ee6e845fd750c219734864", + 0 + }; + static u3j_harm _140_two__in_tap_a[] = {{".2", u3wdi_tap}, {}}; + static c3_c* _140_two__in_tap_ha[] = { + "7dde59e2bd7684e785ce9787bc394571bd1216d7a62398c703447fc951c6b352", + 0 + }; + static u3j_harm _140_two__in_wyt_a[] = {{".2", u3wdi_wyt}, {}}; + static c3_c* _140_two__in_wyt_ha[] = { + "fac9248ebd1defade9df695cd81f94355bebb271f85b164ff34658a5f45c71a0", + 0 + }; + static u3j_harm _140_two__in_uni_a[] = {{".2", u3wdi_uni}, {}}; + static c3_c* _140_two__in_uni_ha[] = { + "6bd72ef1fb12482a839f4435a2b163ace1b56036297a3cec6968be33d6863096", + 0 + }; +static u3j_core _140_two__in_d[] = + { { "apt", 7, _140_two__in_apt_a, 0, _140_two__in_apt_ha }, + { "bif", 7, _140_two__in_bif_a, 0, _140_two__in_bif_ha }, + { "del", 7, _140_two__in_del_a, 0, _140_two__in_del_ha }, + { "dif", 7, _140_two__in_dif_a, 0, _140_two__in_dif_ha }, + { "gas", 7, _140_two__in_gas_a, 0, _140_two__in_gas_ha }, + { "has", 7, _140_two__in_has_a, 0, _140_two__in_has_ha }, + { "int", 7, _140_two__in_int_a, 0, _140_two__in_int_ha }, + { "put", 7, _140_two__in_put_a, 0, _140_two__in_put_ha }, + { "rep", 7, _140_two__in_rep_a, 0, _140_two__in_rep_ha }, + { "run", 7, _140_two__in_run_a, 0, _140_two__in_run_ha }, + { "tap", 7, _140_two__in_tap_a, 0, _140_two__in_tap_ha }, + { "uni", 7, _140_two__in_uni_a, 0, _140_two__in_uni_ha }, + { "wyt", 3, _140_two__in_wyt_a, 0, _140_two__in_wyt_ha }, + {} + }; +static c3_c* _140_two__in_ha[] = { + "8bbb90ce0a49d627194aa267f6cf1fd78df677111b553ce03119fea19f9d763c", + 0 +}; + + static u3j_harm _140_two__by_all_a[] = {{".2", u3wdb_all, c3y}, {}}; + static c3_c* _140_two__by_all_ha[] = { + "c2e87d0047c14b4488d03aad98fa43080c736d86d2ff723a037aaf1843aa9285", + 0 + }; + static u3j_harm _140_two__by_any_a[] = {{".2", u3wdb_any, c3y}, {}}; + static c3_c* _140_two__by_any_ha[] = { + "96b95c942dcbc97f5291fa6f7342c3e19a87d69cc254965b0f75d95133a19301", + 0 + }; + static u3j_harm _140_two__by_apt_a[] = {{".2", u3wdb_apt, c3y}, {}}; + static c3_c* _140_two__by_apt_ha[] = { + "1f0a6f8b945b243520b77069060589938d9e651e34b24924db9528d02a98014f", + 0 + }; + + static u3j_harm _140_two__by_del_a[] = {{".2", u3wdb_del, c3y}, {}}; + static c3_c* _140_two__by_del_ha[] = { + "09f78d6235d3fce8303c7bc663988349b7d4592abdacfb09b833d2f43629b6b6", + 0 + }; + static u3j_harm _140_two__by_dif_a[] = {{".2", u3wdb_dif, c3y}, {}}; + static c3_c* _140_two__by_dif_ha[] = { + "0334e6df6fd0bd5013b94a1b22c29e4c436da0a2d5573f1992faad1c8a059cc7", + 0 + }; + static u3j_harm _140_two__by_gas_a[] = {{".2", u3wdb_gas, c3y}, {}}; + static c3_c* _140_two__by_gas_ha[] = { + "43046602e0b9e568b09448cfe18527e2331f3393a2f32e485d9707a14c346698", + 0 + }; + static u3j_harm _140_two__by_get_a[] = {{".2", u3wdb_get, c3y}, {}}; + static c3_c* _140_two__by_get_ha[] = { + "4de4cea8fa98ef48e9faae10c90ba5bd77971670030ffb00483d0608af4c466f", + 0 + }; + static u3j_harm _140_two__by_has_a[] = {{".2", u3wdb_has, c3y}, {}}; + static c3_c* _140_two__by_has_ha[] = { + "04ecc67ab25961bee1b7c9dbcf42965d16f32474b9bbdd2b286983f998e3957a", + 0 + }; + static u3j_harm _140_two__by_int_a[] = {{".2", u3wdb_int, c3y}, {}}; + static c3_c* _140_two__by_int_ha[] = { + "a2345429482c271a1668f3c0675a559452bb7b13cb7393c3acb7de44c603aef9", + 0 + }; + static u3j_harm _140_two__by_jab_a[] = {{".2", u3wdb_jab, c3y}, {}}; + static c3_c* _140_two__by_jab_ha[] = { + "48930133d9b26e912dce54d1bc486cfe9dcb32bb3c2b1ad76143382799aec156", + 0 + }; + static u3j_harm _140_two__by_key_a[] = {{".2", u3wdb_key, c3y}, {}}; + static c3_c* _140_two__by_key_ha[] = { + "0096c77b93e9fe36b98d9f433eb73300f024283b93b3d73a4001afb9f9804d1b", + 0 + }; + static u3j_harm _140_two__by_put_a[] = {{".2", u3wdb_put, c3y}, {}}; + static c3_c* _140_two__by_put_ha[] = { + "b7307589fed604bfb92e8ad5ffad611c82d835baf02a86c6911b279930f4e8d7", + 0 + }; + static u3j_harm _140_two__by_rep_a[] = {{".2", u3wdb_rep, c3y}, {}}; + static c3_c* _140_two__by_rep_ha[] = { + "05bfb84a52ed8ccc330a96faca29a49afd28300960ac089d00dba32212b971a7", + 0 + }; + static u3j_harm _140_two__by_run_a[] = {{".2", u3wdb_run, c3y}, {}}; + static c3_c* _140_two__by_run_ha[] = { + "adea01e9036e0b40e4969814d4eed935d7d69a52e4a55de5520df2fa5204d8e7", + 0 + }; + static u3j_harm _140_two__by_tap_a[] = {{".2", u3wdb_tap, c3y}, {}}; + static c3_c* _140_two__by_tap_ha[] = { + "7dde59e2bd7684e785ce9787bc394571bd1216d7a62398c703447fc951c6b352", + 0 + }; + static u3j_harm _140_two__by_uni_a[] = {{".2", u3wdb_uni, c3y}, {}}; + static c3_c* _140_two__by_uni_ha[] = { + "f18bc4dac19abe14a6f56afc15d838b7394d48969156f4b37c3c84edd5d46752", + 0 + }; + static u3j_harm _140_two__by_urn_a[] = {{".2", u3wdb_urn, c3y}, {}}; + static c3_c* _140_two__by_urn_ha[] = { + "a409cf78e7f1c2ce8440115730f74367839b658cde2d6a1daa8af067b790eb83", + 0 + }; + static u3j_harm _140_two__by_wyt_a[] = {{".2", u3wdb_wyt, c3y}, {}}; + static c3_c* _140_two__by_wyt_ha[] = { + "fac9248ebd1defade9df695cd81f94355bebb271f85b164ff34658a5f45c71a0", + 0 + }; +static u3j_core _140_two__by_d[] = + { { "all", 7, _140_two__by_all_a, 0, _140_two__by_all_ha }, + { "any", 7, _140_two__by_any_a, 0, _140_two__by_any_ha }, + { "apt", 7, _140_two__by_apt_a, 0, _140_two__by_apt_ha }, + // disabled due to interface change in %138 + // + // { "bif", 7, _140_two__by_bif_a, 0, _140_two__by_bif_ha }, + { "del", 7, _140_two__by_del_a, 0, _140_two__by_del_ha }, + { "dif", 7, _140_two__by_dif_a, 0, _140_two__by_dif_ha }, + { "gas", 7, _140_two__by_gas_a, 0, _140_two__by_gas_ha }, + { "get", 7, _140_two__by_get_a, 0, _140_two__by_get_ha }, + { "has", 7, _140_two__by_has_a, 0, _140_two__by_has_ha }, + { "int", 7, _140_two__by_int_a, 0, _140_two__by_int_ha }, + { "jab", 7, _140_two__by_jab_a, 0, _140_two__by_jab_ha }, + { "key", 7, _140_two__by_key_a, 0, _140_two__by_key_ha }, + { "put", 7, _140_two__by_put_a, 0, _140_two__by_put_ha }, + { "rep", 7, _140_two__by_rep_a, 0, _140_two__by_rep_ha }, + { "run", 7, _140_two__by_run_a, 0, _140_two__by_run_ha }, + { "tap", 7, _140_two__by_tap_a, 0, _140_two__by_tap_ha }, + { "uni", 7, _140_two__by_uni_a, 0, _140_two__by_uni_ha }, + { "urn", 7, _140_two__by_urn_a, 0, _140_two__by_urn_ha }, + { "wyt", 3, _140_two__by_wyt_a, 0, _140_two__by_wyt_ha }, + {} + }; +static c3_c* _140_two__by_ha[] = { + "9c70e973de46335405a7ff932d4742743f54db579f2584758ef2b02afd4fbfe8", + 0 +}; + +static u3j_harm _140_two_cue_a[] = {{".2", u3we_cue}, {}}; +static c3_c* _140_two_cue_ha[] = { + "a52b584c5a92fc653e47f50c3389caf3427e13d20ddb8bd701a2d7bca12cb742", + 0 +}; +static u3j_harm _140_two_jam_a[] = {{".2", u3we_jam}, {}}; +static c3_c* _140_two_jam_ha[] = { + "61f86be74cb1fd5a1d7f531cc9588f8f34a972be8de487c93d25c8e026592ed2", + 0 +}; +static u3j_harm _140_two_mat_a[] = {{".2", u3we_mat}, {}}; +static c3_c* _140_two_mat_ha[] = { + "b5cd9fd1eded54fcb9bfd06af3c34460c1aa4cfc46f1ee9bd3f6476aa8fbb8c8", + 0 +}; +static u3j_harm _140_two_rub_a[] = {{".2", u3we_rub}, {}}; +static c3_c* _140_two_rub_ha[] = { + "87fcf40fb6fce8c3cb778373670d0682785ae650f785531db8ff69d431bc14c6", + 0 +}; + +static u3j_core _140_two_d[] = +{ { "tri", 3, 0, _140_tri_d, _140_tri_ha, _140_tri_ho }, + + { "find", 7, _140_two_find_a, 0, _140_two_find_ha }, + { "flop", 7, _140_two_flop_a, 0, _140_two_flop_ha }, + { "lent", 7, _140_two_lent_a, 0, _140_two_lent_ha }, + { "levy", 7, _140_two_levy_a, 0, _140_two_levy_ha }, + { "lien", 7, _140_two_lien_a, 0, _140_two_lien_ha }, + { "murn", 7, _140_two_murn_a, 0, _140_two_murn_ha }, + { "need", 7, _140_two_need_a, 0, _140_two_need_ha }, + { "reap", 7, _140_two_reap_a, 0, _140_two_reap_ha }, + { "reel", 7, _140_two_reel_a, 0, _140_two_reel_ha }, + { "roll", 7, _140_two_roll_a, 0, _140_two_roll_ha }, + { "skid", 7, _140_two_skid_a, 0, _140_two_skid_ha }, + { "skim", 7, _140_two_skim_a, 0, _140_two_skim_ha }, + { "skip", 7, _140_two_skip_a, 0, _140_two_skip_ha }, + { "scag", 7, _140_two_scag_a, 0, _140_two_scag_ha }, + { "slag", 7, _140_two_slag_a, 0, _140_two_slag_ha }, + { "snag", 7, _140_two_snag_a, 0, _140_two_snag_ha }, + { "sort", 7, _140_two_sort_a, 0, _140_two_sort_ha }, + { "turn", 7, _140_two_turn_a, 0, _140_two_turn_ha }, + { "weld", 7, _140_two_weld_a, 0, _140_two_weld_ha }, + { "welp", 7, _140_two_welp_a, 0, _140_two_welp_ha }, + { "zing", 7, _140_two_zing_a, 0, _140_two_zing_ha }, + + { "bex", 7, _140_two_bex_a, 0, _140_two_bex_ha }, + { "cat", 7, _140_two_cat_a, 0, _140_two_cat_ha }, + { "can", 7, _140_two_can_a, 0, _140_two_can_ha }, + { "con", 7, _140_two_con_a, 0, _140_two_con_ha }, + { "cue", 7, _140_two_cue_a, 0, _140_two_cue_ha }, + { "cut", 7, _140_two_cut_a, 0, _140_two_cut_ha }, + { "dis", 7, _140_two_dis_a, 0, _140_two_dis_ha }, + { "dor", 7, _140_two_dor_a, 0, _140_two_dor_ha }, + { "end", 7, _140_two_end_a, 0, _140_two_end_ha }, + { "gor", 7, _140_two_gor_a, 0, _140_two_gor_ha }, + { "jam", 7, _140_two_jam_a, 0, _140_two_jam_ha }, + { "lsh", 7, _140_two_lsh_a, 0, _140_two_lsh_ha }, + { "mat", 7, _140_two_mat_a, 0, _140_two_mat_ha }, + { "met", 7, _140_two_met_a, 0, _140_two_met_ha }, + { "mix", 7, _140_two_mix_a, 0, _140_two_mix_ha }, + { "mor", 7, _140_two_mor_a, 0, _140_two_mor_ha }, + { "mug", 7, _140_two_mug_a, 0, _140_two_mug_ha }, + { "muk", 59, _140_two_muk_a, 0, _140_two_muk_ha }, + { "rap", 7, _140_two_rap_a, 0, _140_two_rap_ha }, + { "rep", 7, _140_two_rep_a, 0, _140_two_rep_ha }, + { "rev", 7, _140_two_rev_a, 0, _140_two_rev_ha }, + { "rip", 7, _140_two_rip_a, 0, _140_two_rip_ha }, + { "rsh", 7, _140_two_rsh_a, 0, _140_two_rsh_ha }, + { "swp", 7, _140_two_swp_a, 0, _140_two_swp_ha }, + { "rub", 7, _140_two_rub_a, 0, _140_two_rub_ha }, + { "pow", 7, _140_two_pow_a, 0, _140_two_pow_ha }, + { "sqt", 7, _140_two_sqt_a, 0, _140_two_sqt_ha }, + { "xeb", 7, _140_two_xeb_a, 0, _140_two_xeb_ha }, + + { "by", 7, 0, _140_two__by_d, _140_two__by_ha }, + { "in", 7, 0, _140_two__in_d, _140_two__in_ha }, + {} +}; +static c3_c* _140_two_ha[] = { + "f693e1f5ff57ec741fe28a48a18252b3e12dead2bfe3bcd4ea8e904a36905c0b", + 0 +}; + + +/* layer one +*/ +static u3j_harm _140_one_add_a[] = {{".2", u3wa_add, c3y}, {}}; +static c3_c* _140_one_add_ha[] = { + "46407e27fe5d7c20b3ba25c02657c227b37217ddab8501b2d3b70b818aca7a44", + 0 +}; +static u3j_harm _140_one_dec_a[] = {{".2", u3wa_dec, c3y}, {}}; +static c3_c* _140_one_dec_ha[] = { + "6345d28d34c62c4b4f9da98828574bc9060ff0869789968d9045d90faeb3580c", + 0 +}; +static u3j_harm _140_one_div_a[] = {{".2", u3wa_div, c3y}, {}}; +static c3_c* _140_one_div_ha[] = { + "e3292e76feb274b9314e7693827de11e96677629c556b3a6c72cc15ebad45113", + 0 +}; +static u3j_harm _140_one_dvr_a[] = {{".2", u3wc_dvr, c3y}, {}}; +static c3_c* _140_one_dvr_ha[] = { + "fc259f46d770f82767163544f3662dfd45b1484a7bcffad396c7420651f092a4", + 0 +}; +static u3j_harm _140_one_gte_a[] = {{".2", u3wa_gte, c3y}, {}}; +static c3_c* _140_one_gte_ha[] = { + "f3ff2c0fc1f386226183e8834cff87420a1206583f8710e1e75f0e34ed8df5fe", + 0 +}; +static u3j_harm _140_one_gth_a[] = {{".2", u3wa_gth, c3y}, {}}; +static c3_c* _140_one_gth_ha[] = { + "62692d64c8166c7d48bb2a00713064846da9629a1dd2d924c3b15cfd18a5912a", + 0 +}; +static u3j_harm _140_one_lte_a[] = {{".2", u3wa_lte, c3y}, {}}; +static c3_c* _140_one_lte_ha[] = { + "6ca61752aa27b453f28f20e12f652610d45695c3bd965190d5b4fa8b9daa518c", + 0 +}; +static u3j_harm _140_one_lth_a[] = {{".2", u3wa_lth, c3y}, {}}; +static c3_c* _140_one_lth_ha[] = { + "39260325faffbbf5bd88c4abb3efb09c5a7e1deb81a2126498d6c0f49474955e", + 0 +}; +static u3j_harm _140_one_max_a[] = {{".2", u3wa_max, c3y}, {}}; +static c3_c* _140_one_max_ha[] = { + "39260325faffbbf5bd88c4abb3efb09c5a7e1deb81a2126498d6c0f49474955e", + 0 +}; +static u3j_harm _140_one_min_a[] = {{".2", u3wa_min, c3y}, {}}; +static c3_c* _140_one_min_ha[] = { + "39260325faffbbf5bd88c4abb3efb09c5a7e1deb81a2126498d6c0f49474955e", + 0 +}; +static u3j_harm _140_one_mod_a[] = {{".2", u3wa_mod, c3y}, {}}; +static c3_c* _140_one_mod_ha[] = { + "374d2f3cd0ece33f680bd7103b99891d7dae03590f9eb9faac03a4a501f17038", + 0 +}; +static u3j_harm _140_one_mul_a[] = {{".2", u3wa_mul, c3y}, {}}; +static c3_c* _140_one_mul_ha[] = { + "51e45dbea29cf65a5c26ead095a20eb12ba078840652c88b9c1997820e670bc6", + 0 +}; +static u3j_harm _140_one_sub_a[] = {{".2", u3wa_sub, c3y}, {}}; +static c3_c* _140_one_sub_ha[] = { + "016695719ffe93c177e8a03afa5d29fc428ff596bb8962ace50f7706cd6e53a6", + 0 +}; + +static u3j_harm _140_one_cap_a[] = {{".2", u3wc_cap, c3y}, {}}; +static c3_c* _140_one_cap_ha[] = { + "407e764ee978c712b81c9c3452932e0f7d33faeda36dfe99aaf81d543db16254", + 0 +}; +static u3j_harm _140_one_peg_a[] = {{".2", u3wc_peg, c3y}, {}}; +static c3_c* _140_one_peg_ha[] = { + "8b608d2d2e2eccec3e2fc8cd2d92fd69504c72b26581bb9cbfa4ff51f997251f", + 0 +}; +static u3j_harm _140_one_mas_a[] = {{".2", u3wc_mas, c3y}, {}}; +static c3_c* _140_one_mas_ha[] = { + "1439dcd809f0819b09fb5fe7e83bc1292ca6fd33b5819d78e706d402c053b02a", + 0 +}; + +static u3j_core _140_one_d[] = +{ { "two", 3, 0, _140_two_d, _140_two_ha }, + + { "add", 7, _140_one_add_a, 0, _140_one_add_ha }, + { "dec", 7, _140_one_dec_a, 0, _140_one_dec_ha }, + { "div", 7, _140_one_div_a, 0, _140_one_div_ha }, + { "dvr", 7, _140_one_dvr_a, 0, _140_one_dvr_ha }, + { "gte", 7, _140_one_gte_a, 0, _140_one_gte_ha }, + { "gth", 7, _140_one_gth_a, 0, _140_one_gth_ha }, + { "lte", 7, _140_one_lte_a, 0, _140_one_lte_ha }, + { "lth", 7, _140_one_lth_a, 0, _140_one_lth_ha }, + { "max", 7, _140_one_max_a, 0, _140_one_max_ha }, + { "min", 7, _140_one_min_a, 0, _140_one_min_ha }, + { "mod", 7, _140_one_mod_a, 0, _140_one_mod_ha }, + { "mul", 7, _140_one_mul_a, 0, _140_one_mul_ha }, + { "sub", 7, _140_one_sub_a, 0, _140_one_sub_ha }, + + { "cap", 7, _140_one_cap_a, 0, _140_one_cap_ha }, + { "mas", 7, _140_one_mas_a, 0, _140_one_mas_ha }, + { "peg", 7, _140_one_peg_a, 0, _140_one_peg_ha }, + {} +}; +static c3_c* _140_one_ha[] = { + "2501f8dbe62384d144ab0f805501ed66325bd77a733eca0c80d1da673e4b16fb", + 0 +}; + +u3j_core _k140_d[] = +{ { "one", 3, 0, _140_one_d, _140_one_ha }, + {} +}; +static c3_c* _k140_ha[] = { + "9b82a903093c077afb3f0b9d4e95e1a9c9789d1ca605b57bbacf79857e3d5c52", + 0 +}; + +/* new jets +*/ + static u3j_harm _139_hex_json_de_a[] = {{".2", u3we_json_de}, {}}; + static u3j_harm _139_hex_json_en_a[] = {{".2", u3we_json_en}, {}}; +static u3j_core _139_hex_json_d[] = + { { "de", 15, _139_hex_json_de_a, 0, no_hashes }, + { "en", 15, _139_hex_json_en_a, 0, no_hashes }, + {} + }; + + + +static u3j_core _139_hex_d[] = +{ + { "lore", 63, _140_hex_lore_a, 0, no_hashes }, + { "leer", 63, _140_hex_leer_a, 0, no_hashes }, + { "loss", 63, _140_hex_loss_a, 0, no_hashes }, + { "lune", 127, _140_hex_lune_a, 0, no_hashes }, + + { "coed", 63, 0, _140_hex_coed_d, no_hashes }, + { "aes", 31, 0, _140_hex_aes_d, no_hashes }, + + { "hmac", 63, 0, _140_hex_hmac_d, no_hashes }, + { "argon", 31, 0, _140_hex_argon_d, no_hashes }, + { "blake", 31, 0, _140_hex_blake_d, no_hashes }, + { "kecc", 31, 0, _140_hex_kecc_d, no_hashes }, + { "ripemd", 31, 0, _140_hex_ripe_d, no_hashes }, + { "scr", 31, 0, _140_hex_scr_d, no_hashes }, + { "secp", 6, 0, _140_hex_secp_d, no_hashes }, + { "mimes", 31, 0, _140_hex_mimes_d, no_hashes }, + { "json", 31, 0, _139_hex_json_d, no_hashes }, + {} +}; + +static u3j_core _139_pen_d[] = +{ { "hex", 7, 0, _139_hex_d, no_hashes }, + + { "cell", 7, _140_pen_cell_a, 0, no_hashes }, + { "comb", 7, _140_pen_comb_a, 0, no_hashes }, + { "cons", 7, _140_pen_cons_a, 0, no_hashes }, + { "core", 7, _140_pen_core_a, 0, no_hashes }, + { "face", 7, _140_pen_face_a, 0, no_hashes }, + { "fitz", 7, _140_pen_fitz_a, 0, no_hashes }, + { "flan", 7, _140_pen_flan_a, 0, no_hashes }, + { "flip", 7, _140_pen_flip_a, 0, no_hashes }, + { "flor", 7, _140_pen_flor_a, 0, no_hashes }, + { "fork", 7, _140_pen_fork_a, 0, no_hashes }, + { "look", 7, _140_pen_look_a, 0, no_hashes }, + { "loot", 7, _140_pen_loot_a, 0, no_hashes }, + { "ut", 15, 0, _140_pen__ut_d, no_hashes, _140_pen__ut_ho }, + {} +}; + +static u3j_core _139_qua_d[] = +{ { "pen", 3, 0, _139_pen_d, no_hashes, _140_pen_ho }, + + { "po", 7, 0, _140_qua__po_d, no_hashes }, + + { "trip", 7, _140_qua_trip_a, 0, no_hashes }, + + { "bend", 7, 0, _140_qua__bend_d, no_hashes }, + { "cold", 7, 0, _140_qua__cold_d, no_hashes }, + { "comp", 7, 0, _140_qua__comp_d, no_hashes }, + { "cook", 7, 0, _140_qua__cook_d, no_hashes }, + { "easy", 7, 0, _140_qua__easy_d, no_hashes }, + { "glue", 7, 0, _140_qua__glue_d, no_hashes }, + { "here", 7, 0, _140_qua__here_d, no_hashes }, + { "just", 7, 0, _140_qua__just_d, no_hashes }, + { "mask", 7, 0, _140_qua__mask_d, no_hashes }, + { "shim", 7, 0, _140_qua__shim_d, no_hashes }, + { "stag", 7, 0, _140_qua__stag_d, no_hashes }, + { "stew", 7, 0, _140_qua__stew_d, no_hashes }, + { "stir", 7, 0, _140_qua__stir_d, no_hashes }, + + { "pfix", 7, _140_qua_pfix_a, 0, no_hashes }, + { "plug", 7, _140_qua_plug_a, 0, no_hashes }, + { "pose", 7, _140_qua_pose_a, 0, no_hashes }, + { "sfix", 7, _140_qua_sfix_a, 0, no_hashes }, + + { "mink", 7, _140_qua_mink_a, 0, no_hashes }, + { "mole", 7, _140_qua_mole_a, 0, no_hashes }, + { "mule", 7, _140_qua_mule_a, 0, no_hashes }, + + { "scot", 7, _140_qua_scot_a, 0, no_hashes }, + { "scow", 7, _140_qua_scow_a, 0, no_hashes }, + { "slaw", 7, _140_qua_slaw_a, 0, no_hashes }, + {} +}; + +static u3j_core _139_tri_d[] = +{ { "qua", 3, 0, _139_qua_d, no_hashes, _140_qua_ho }, + + { "cofl", 7, 0, _140_tri__cofl_d, no_hashes }, + { "rd", 7, 0, _140_tri__rd_d, no_hashes }, + { "rs", 7, 0, _140_tri__rs_d, no_hashes }, + { "rq", 7, 0, _140_tri__rq_d, no_hashes }, + { "rh", 7, 0, _140_tri__rh_d, no_hashes }, + { "og", 7, 0, _140_tri__og_d, no_hashes }, + + { "sha", 7, 0, _140_tri__sha_d, no_hashes }, + { "shax", 7, _140_tri_shax_a, 0, no_hashes }, + { "shay", 7, _140_tri_shay_a, 0, no_hashes }, + { "shas", 7, _140_tri_shas_a, 0, no_hashes }, + { "shal", 7, _140_tri_shal_a, 0, no_hashes }, + + { "ob", 3, 0, _140_ob_d, no_hashes, _140_ob_ho }, + {} +}; + +static u3j_harm _139_two__in_apt_a[] = {{".2", u3wdi_apt}, {}}; + +static u3j_core _139_two__in_d[] = + { { "apt", 7, _139_two__in_apt_a, 0, no_hashes }, + { "bif", 7, _140_two__in_bif_a, 0, no_hashes }, + { "del", 7, _140_two__in_del_a, 0, no_hashes }, + { "dif", 7, _140_two__in_dif_a, 0, no_hashes }, + { "gas", 7, _140_two__in_gas_a, 0, no_hashes }, + { "has", 7, _140_two__in_has_a, 0, no_hashes }, + { "int", 7, _140_two__in_int_a, 0, no_hashes }, + { "put", 7, _140_two__in_put_a, 0, no_hashes }, + { "rep", 7, _140_two__in_rep_a, 0, no_hashes }, + { "run", 7, _140_two__in_run_a, 0, no_hashes }, + { "tap", 7, _140_two__in_tap_a, 0, no_hashes }, + { "uni", 7, _140_two__in_uni_a, 0, no_hashes }, + { "wyt", 3, _140_two__in_wyt_a, 0, no_hashes }, + {} + }; + +static u3j_core _139_two_d[] = +{ { "tri", 3, 0, _139_tri_d, no_hashes, _140_tri_ho }, + + { "find", 7, _140_two_find_a, 0, no_hashes }, + { "flop", 7, _140_two_flop_a, 0, no_hashes }, + { "lent", 7, _140_two_lent_a, 0, no_hashes }, + { "levy", 7, _140_two_levy_a, 0, no_hashes }, + { "lien", 7, _140_two_lien_a, 0, no_hashes }, + { "murn", 7, _140_two_murn_a, 0, no_hashes }, + { "need", 7, _140_two_need_a, 0, no_hashes }, + { "reap", 7, _140_two_reap_a, 0, no_hashes }, + { "reel", 7, _140_two_reel_a, 0, no_hashes }, + { "roll", 7, _140_two_roll_a, 0, no_hashes }, + { "skid", 7, _140_two_skid_a, 0, no_hashes }, + { "skim", 7, _140_two_skim_a, 0, no_hashes }, + { "skip", 7, _140_two_skip_a, 0, no_hashes }, + { "scag", 7, _140_two_scag_a, 0, no_hashes }, + { "slag", 7, _140_two_slag_a, 0, no_hashes }, + { "snag", 7, _140_two_snag_a, 0, no_hashes }, + { "sort", 7, _140_two_sort_a, 0, no_hashes }, + { "turn", 7, _140_two_turn_a, 0, no_hashes }, + { "weld", 7, _140_two_weld_a, 0, no_hashes }, + { "welp", 7, _140_two_welp_a, 0, no_hashes }, + { "zing", 7, _140_two_zing_a, 0, no_hashes }, + + { "bex", 7, _140_two_bex_a, 0, no_hashes }, + { "cat", 7, _140_two_cat_a, 0, no_hashes }, + { "can", 7, _140_two_can_a, 0, no_hashes }, + { "con", 7, _140_two_con_a, 0, no_hashes }, + { "cue", 7, _140_two_cue_a, 0, no_hashes }, + { "cut", 7, _140_two_cut_a, 0, no_hashes }, + { "dis", 7, _140_two_dis_a, 0, no_hashes }, + { "dor", 7, _140_two_dor_a, 0, no_hashes }, + { "end", 7, _140_two_end_a, 0, no_hashes }, + { "gor", 7, _140_two_gor_a, 0, no_hashes }, + { "jam", 7, _140_two_jam_a, 0, no_hashes }, + { "lsh", 7, _140_two_lsh_a, 0, no_hashes }, + { "mat", 7, _140_two_mat_a, 0, no_hashes }, + { "met", 7, _140_two_met_a, 0, no_hashes }, + { "mix", 7, _140_two_mix_a, 0, no_hashes }, + { "mor", 7, _140_two_mor_a, 0, no_hashes }, + { "mug", 7, _140_two_mug_a, 0, no_hashes }, + { "muk", 59, _140_two_muk_a, 0, no_hashes }, + { "rap", 7, _140_two_rap_a, 0, no_hashes }, + { "rep", 7, _140_two_rep_a, 0, no_hashes }, + { "rev", 7, _140_two_rev_a, 0, no_hashes }, + { "rip", 7, _140_two_rip_a, 0, no_hashes }, + { "rsh", 7, _140_two_rsh_a, 0, no_hashes }, + { "swp", 7, _140_two_swp_a, 0, no_hashes }, + { "rub", 7, _140_two_rub_a, 0, no_hashes }, + { "pow", 7, _140_two_pow_a, 0, no_hashes }, + { "sqt", 7, _140_two_sqt_a, 0, no_hashes }, + { "xeb", 7, _140_two_xeb_a, 0, no_hashes }, + + { "by", 7, 0, _140_two__by_d, no_hashes }, + { "in", 7, 0, _139_two__in_d, no_hashes }, + {} +}; + +static u3j_core _139_one_d[] = +{ { "two", 3, 0, _139_two_d, no_hashes }, + + { "add", 7, _140_one_add_a, 0, no_hashes }, + { "dec", 7, _140_one_dec_a, 0, no_hashes }, + { "div", 7, _140_one_div_a, 0, no_hashes }, + { "dvr", 7, _140_one_dvr_a, 0, no_hashes }, + { "gte", 7, _140_one_gte_a, 0, no_hashes }, + { "gth", 7, _140_one_gth_a, 0, no_hashes }, + { "lte", 7, _140_one_lte_a, 0, no_hashes }, + { "lth", 7, _140_one_lth_a, 0, no_hashes }, + { "max", 7, _140_one_max_a, 0, no_hashes }, + { "min", 7, _140_one_min_a, 0, no_hashes }, + { "mod", 7, _140_one_mod_a, 0, no_hashes }, + { "mul", 7, _140_one_mul_a, 0, no_hashes }, + { "sub", 7, _140_one_sub_a, 0, no_hashes }, + + { "cap", 7, _140_one_cap_a, 0, no_hashes }, + { "mas", 7, _140_one_mas_a, 0, no_hashes }, + { "peg", 7, _140_one_peg_a, 0, no_hashes }, + {} +}; + +u3j_core _k139_d[] = +{ { "one", 3, 0, _139_one_d, no_hashes }, + {} +}; + + static u3j_harm _138_hex_blake3_hash_a[] = {{".2", u3we_blake3_hash, c3y}, {}}; + static u3j_harm _138_hex_blake3_compress_a[] = {{".2", u3we_blake3_compress, c3y}, {}}; + static u3j_harm _138_hex_blake3_chunk_output_a[] = {{".2", u3we_blake3_chunk_output, c3y}, {}}; + static u3j_core _138_hex_blake3_d[] = + { { "hash", 7, _138_hex_blake3_hash_a, 0, no_hashes }, + { "chunk-output", 7, _138_hex_blake3_chunk_output_a, 0, no_hashes }, + {} + }; + static u3j_core _138_hex_blake3_impl_d[] = + { { "compress", 7, _138_hex_blake3_compress_a, 0, no_hashes }, + { "blake3", 7, 0, _138_hex_blake3_d, no_hashes }, + {} + }; +static u3j_core _138_hex_blake_d[] = + { { "blake2b", 7, _140_hex_blake2b_a, 0, no_hashes }, + { "blake3-impl", 7, 0, _138_hex_blake3_impl_d, no_hashes }, + {} + }; + + static u3j_harm _138_hex_chacha_crypt_a[] = {{".2", u3we_chacha_crypt, c3y}, {}}; + static u3j_harm _138_hex_chacha_xchacha_a[] = {{".2", u3we_chacha_xchacha, c3y}, {}}; +static u3j_core _138_hex_chacha_d[] = + { { "crypt", 7, _138_hex_chacha_crypt_a, 0, no_hashes }, + { "xchacha", 7, _138_hex_chacha_xchacha_a, 0, no_hashes }, + {} + }; + +static u3j_core _138_hex_d[] = +{ { "lore", 63, _140_hex_lore_a, 0, no_hashes }, + { "leer", 63, _140_hex_leer_a, 0, no_hashes }, + { "loss", 63, _140_hex_loss_a, 0, no_hashes }, + { "lune", 127, _140_hex_lune_a, 0, no_hashes }, + + { "coed", 63, 0, _140_hex_coed_d, no_hashes }, + { "aes", 31, 0, _140_hex_aes_d, no_hashes }, + + { "hmac", 63, 0, _140_hex_hmac_d, no_hashes }, + { "argon", 31, 0, _140_hex_argon_d, no_hashes }, + { "blake", 31, 0, _138_hex_blake_d, no_hashes }, + { "chacha", 31, 0, _138_hex_chacha_d, no_hashes }, + { "kecc", 31, 0, _140_hex_kecc_d, no_hashes }, + { "ripemd", 31, 0, _140_hex_ripe_d, no_hashes }, + { "scr", 31, 0, _140_hex_scr_d, no_hashes }, + { "secp", 6, 0, _140_hex_secp_d, no_hashes }, + { "mimes", 31, 0, _140_hex_mimes_d, no_hashes }, + { "json", 31, 0, _139_hex_json_d, no_hashes }, + {} +}; + +static u3j_core _138_pen_d[] = +{ { "hex", 7, 0, _138_hex_d, no_hashes }, + + { "cell", 7, _140_pen_cell_a, 0, no_hashes }, + { "comb", 7, _140_pen_comb_a, 0, no_hashes }, + { "cons", 7, _140_pen_cons_a, 0, no_hashes }, + { "core", 7, _140_pen_core_a, 0, no_hashes }, + { "face", 7, _140_pen_face_a, 0, no_hashes }, + { "fitz", 7, _140_pen_fitz_a, 0, no_hashes }, + // flan, flip, and flor removed + // + { "fork", 7, _140_pen_fork_a, 0, no_hashes }, + { "look", 7, _140_pen_look_a, 0, no_hashes }, + { "loot", 7, _140_pen_loot_a, 0, no_hashes }, + { "ut", 15, 0, _140_pen__ut_d, no_hashes, _140_pen__ut_ho }, + {} +}; + +static u3j_core _138_qua_d[] = +{ { "pen", 3, 0, _138_pen_d, no_hashes, _140_pen_ho }, + + { "po", 7, 0, _140_qua__po_d, no_hashes }, + + { "trip", 7, _140_qua_trip_a, 0, no_hashes }, + + { "bend", 7, 0, _140_qua__bend_d, no_hashes }, + { "cold", 7, 0, _140_qua__cold_d, no_hashes }, + { "comp", 7, 0, _140_qua__comp_d, no_hashes }, + { "cook", 7, 0, _140_qua__cook_d, no_hashes }, + { "easy", 7, 0, _140_qua__easy_d, no_hashes }, + { "glue", 7, 0, _140_qua__glue_d, no_hashes }, + { "here", 7, 0, _140_qua__here_d, no_hashes }, + { "just", 7, 0, _140_qua__just_d, no_hashes }, + { "mask", 7, 0, _140_qua__mask_d, no_hashes }, + { "shim", 7, 0, _140_qua__shim_d, no_hashes }, + { "stag", 7, 0, _140_qua__stag_d, no_hashes }, + { "stew", 7, 0, _140_qua__stew_d, no_hashes }, + { "stir", 7, 0, _140_qua__stir_d, no_hashes }, + + { "pfix", 7, _140_qua_pfix_a, 0, no_hashes }, + { "plug", 7, _140_qua_plug_a, 0, no_hashes }, + { "pose", 7, _140_qua_pose_a, 0, no_hashes }, + { "sfix", 7, _140_qua_sfix_a, 0, no_hashes }, + + { "mink", 7, _140_qua_mink_a, 0, no_hashes }, + { "mole", 7, _140_qua_mole_a, 0, no_hashes }, + { "mule", 7, _140_qua_mule_a, 0, no_hashes }, + + { "scot", 7, _140_qua_scot_a, 0, no_hashes }, + { "scow", 7, _140_qua_scow_a, 0, no_hashes }, + { "slaw", 7, _140_qua_slaw_a, 0, no_hashes }, + {} +}; + +static u3j_core _138_tri_d[] = +{ { "qua", 3, 0, _138_qua_d, no_hashes, _140_qua_ho }, + + { "cofl", 7, 0, _140_tri__cofl_d, no_hashes }, + { "rd", 7, 0, _140_tri__rd_d, no_hashes }, + { "rs", 7, 0, _140_tri__rs_d, no_hashes }, + { "rq", 7, 0, _140_tri__rq_d, no_hashes }, + { "rh", 7, 0, _140_tri__rh_d, no_hashes }, + { "og", 7, 0, _140_tri__og_d, no_hashes }, + + { "sha", 7, 0, _140_tri__sha_d, no_hashes }, + { "shax", 7, _140_tri_shax_a, 0, no_hashes }, + { "shay", 7, _140_tri_shay_a, 0, no_hashes }, + { "shas", 7, _140_tri_shas_a, 0, no_hashes }, + { "shal", 7, _140_tri_shal_a, 0, no_hashes }, + + { "ob", 3, 0, _140_ob_d, no_hashes, _140_ob_ho }, + {} +}; + +static u3j_harm _138_two__by_bif_a[] = {{".2", u3wdb_bif, c3y}, {}}; + +static u3j_core _138_two__by_d[] = + { { "all", 7, _140_two__by_all_a, 0, _140_two__by_all_ha }, + { "any", 7, _140_two__by_any_a, 0, _140_two__by_any_ha }, + { "apt", 7, _140_two__by_apt_a, 0, _140_two__by_apt_ha }, + { "bif", 7, _138_two__by_bif_a, 0, no_hashes }, + { "del", 7, _140_two__by_del_a, 0, _140_two__by_del_ha }, + { "dif", 7, _140_two__by_dif_a, 0, _140_two__by_dif_ha }, + { "gas", 7, _140_two__by_gas_a, 0, _140_two__by_gas_ha }, + { "get", 7, _140_two__by_get_a, 0, _140_two__by_get_ha }, + { "has", 7, _140_two__by_has_a, 0, _140_two__by_has_ha }, + { "int", 7, _140_two__by_int_a, 0, _140_two__by_int_ha }, + { "jab", 7, _140_two__by_jab_a, 0, _140_two__by_jab_ha }, + { "key", 7, _140_two__by_key_a, 0, _140_two__by_key_ha }, + { "put", 7, _140_two__by_put_a, 0, _140_two__by_put_ha }, + { "rep", 7, _140_two__by_rep_a, 0, _140_two__by_rep_ha }, + { "run", 7, _140_two__by_run_a, 0, _140_two__by_run_ha }, + { "tap", 7, _140_two__by_tap_a, 0, _140_two__by_tap_ha }, + { "uni", 7, _140_two__by_uni_a, 0, _140_two__by_uni_ha }, + { "urn", 7, _140_two__by_urn_a, 0, _140_two__by_urn_ha }, + { "wyt", 3, _140_two__by_wyt_a, 0, _140_two__by_wyt_ha }, + {} + }; + +static u3j_harm _138_two_mate_a[] = {{".2", u3wb_mate, c3y}, {}}; + +static u3j_harm _138_two_aor_a[] = {{".2", u3wc_aor, c3y}, {}}; + +static u3j_core _138_two_d[] = +{ { "tri", 3, 0, _138_tri_d, no_hashes, _140_tri_ho }, + + { "find", 7, _140_two_find_a, 0, no_hashes }, + { "flop", 7, _140_two_flop_a, 0, no_hashes }, + { "lent", 7, _140_two_lent_a, 0, no_hashes }, + { "levy", 7, _140_two_levy_a, 0, no_hashes }, + { "lien", 7, _140_two_lien_a, 0, no_hashes }, + { "murn", 7, _140_two_murn_a, 0, no_hashes }, + { "need", 7, _140_two_need_a, 0, no_hashes }, + { "mate", 7, _138_two_mate_a, 0, no_hashes }, + { "reap", 7, _140_two_reap_a, 0, no_hashes }, + { "reel", 7, _140_two_reel_a, 0, no_hashes }, + { "roll", 7, _140_two_roll_a, 0, no_hashes }, + { "skid", 7, _140_two_skid_a, 0, no_hashes }, + { "skim", 7, _140_two_skim_a, 0, no_hashes }, + { "skip", 7, _140_two_skip_a, 0, no_hashes }, + { "scag", 7, _140_two_scag_a, 0, no_hashes }, + { "slag", 7, _140_two_slag_a, 0, no_hashes }, + { "snag", 7, _140_two_snag_a, 0, no_hashes }, + { "sort", 7, _140_two_sort_a, 0, no_hashes }, + { "turn", 7, _140_two_turn_a, 0, no_hashes }, + { "weld", 7, _140_two_weld_a, 0, no_hashes }, + { "welp", 7, _140_two_welp_a, 0, no_hashes }, + { "zing", 7, _140_two_zing_a, 0, no_hashes }, + + { "aor", 7, _138_two_aor_a, 0, no_hashes }, + { "bex", 7, _140_two_bex_a, 0, no_hashes }, + { "cat", 7, _140_two_cat_a, 0, no_hashes }, + { "can", 7, _140_two_can_a, 0, no_hashes }, + { "con", 7, _140_two_con_a, 0, no_hashes }, + { "cue", 7, _140_two_cue_a, 0, no_hashes }, + { "cut", 7, _140_two_cut_a, 0, no_hashes }, + { "dis", 7, _140_two_dis_a, 0, no_hashes }, + { "dor", 7, _140_two_dor_a, 0, no_hashes }, + { "end", 7, _140_two_end_a, 0, no_hashes }, + { "gor", 7, _140_two_gor_a, 0, no_hashes }, + { "jam", 7, _140_two_jam_a, 0, no_hashes }, + { "lsh", 7, _140_two_lsh_a, 0, no_hashes }, + { "mat", 7, _140_two_mat_a, 0, no_hashes }, + { "met", 7, _140_two_met_a, 0, no_hashes }, + { "mix", 7, _140_two_mix_a, 0, no_hashes }, + { "mor", 7, _140_two_mor_a, 0, no_hashes }, + { "mug", 7, _140_two_mug_a, 0, no_hashes }, + { "muk", 59, _140_two_muk_a, 0, no_hashes }, + { "rap", 7, _140_two_rap_a, 0, no_hashes }, + { "rep", 7, _140_two_rep_a, 0, no_hashes }, + { "rev", 7, _140_two_rev_a, 0, no_hashes }, + { "rip", 7, _140_two_rip_a, 0, no_hashes }, + { "rsh", 7, _140_two_rsh_a, 0, no_hashes }, + { "swp", 7, _140_two_swp_a, 0, no_hashes }, + { "rub", 7, _140_two_rub_a, 0, no_hashes }, + { "pow", 7, _140_two_pow_a, 0, no_hashes }, + { "sqt", 7, _140_two_sqt_a, 0, no_hashes }, + { "xeb", 7, _140_two_xeb_a, 0, no_hashes }, + + { "by", 7, 0, _138_two__by_d, no_hashes }, + { "in", 7, 0, _139_two__in_d, no_hashes }, + {} +}; + +static u3j_core _138_one_d[] = +{ { "two", 3, 0, _138_two_d, no_hashes }, + + { "add", 7, _140_one_add_a, 0, no_hashes }, + { "dec", 7, _140_one_dec_a, 0, no_hashes }, + { "div", 7, _140_one_div_a, 0, no_hashes }, + { "dvr", 7, _140_one_dvr_a, 0, no_hashes }, + { "gte", 7, _140_one_gte_a, 0, no_hashes }, + { "gth", 7, _140_one_gth_a, 0, no_hashes }, + { "lte", 7, _140_one_lte_a, 0, no_hashes }, + { "lth", 7, _140_one_lth_a, 0, no_hashes }, + { "max", 7, _140_one_max_a, 0, no_hashes }, + { "min", 7, _140_one_min_a, 0, no_hashes }, + { "mod", 7, _140_one_mod_a, 0, no_hashes }, + { "mul", 7, _140_one_mul_a, 0, no_hashes }, + { "sub", 7, _140_one_sub_a, 0, no_hashes }, + + { "cap", 7, _140_one_cap_a, 0, no_hashes }, + { "mas", 7, _140_one_mas_a, 0, no_hashes }, + { "peg", 7, _140_one_peg_a, 0, no_hashes }, + {} +}; + +static u3j_core _k138_d[] = +{ { "one", 3, 0, _138_one_d, no_hashes }, + {} +}; + + +static u3j_core _a50_two__by_d[] = + { { "apt", 7, _140_two__by_apt_a, 0, _140_two__by_apt_ha }, + { "del", 7, _140_two__by_del_a, 0, _140_two__by_del_ha }, + { "get", 7, _140_two__by_get_a, 0, _140_two__by_get_ha }, + { "has", 7, _140_two__by_has_a, 0, _140_two__by_has_ha }, + { "put", 7, _140_two__by_put_a, 0, _140_two__by_put_ha }, + {} + }; + +static u3j_core _a50_two__in_d[] = + { { "apt", 7, _140_two__in_apt_a, 0, _140_two__in_apt_ha }, // NB: 140 jet + { "del", 7, _140_two__in_del_a, 0, _140_two__in_del_ha }, + { "put", 7, _140_two__in_put_a, 0, _140_two__in_put_ha }, + {} + }; + +u3j_core _a50_d[] = +{ { "add", 7, _140_one_add_a, 0, _140_one_add_ha }, + { "dec", 7, _140_one_dec_a, 0, _140_one_dec_ha }, + { "div", 7, _140_one_div_a, 0, _140_one_div_ha }, + { "dvr", 7, _140_one_dvr_a, 0, _140_one_dvr_ha }, + { "gte", 7, _140_one_gte_a, 0, _140_one_gte_ha }, + { "gth", 7, _140_one_gth_a, 0, _140_one_gth_ha }, + { "lte", 7, _140_one_lte_a, 0, _140_one_lte_ha }, + { "lth", 7, _140_one_lth_a, 0, _140_one_lth_ha }, + { "mod", 7, _140_one_mod_a, 0, _140_one_mod_ha }, + { "mul", 7, _140_one_mul_a, 0, _140_one_mul_ha }, + { "sub", 7, _140_one_sub_a, 0, _140_one_sub_ha }, + + { "bex", 7, _140_two_bex_a, 0, _140_two_bex_ha }, + { "cat", 7, _140_two_cat_a, 0, _140_two_cat_ha }, + { "can", 7, _140_two_can_a, 0, _140_two_can_ha }, + { "con", 7, _140_two_con_a, 0, _140_two_con_ha }, + { "cut", 7, _140_two_cut_a, 0, _140_two_cut_ha }, + { "dis", 7, _140_two_dis_a, 0, _140_two_dis_ha }, + { "dor", 7, _140_two_dor_a, 0, _140_two_dor_ha }, + { "end", 7, _140_two_end_a, 0, _140_two_end_ha }, + { "gor", 7, _140_two_gor_a, 0, _140_two_gor_ha }, + { "lsh", 7, _140_two_lsh_a, 0, _140_two_lsh_ha }, + { "met", 7, _140_two_met_a, 0, _140_two_met_ha }, + { "mix", 7, _140_two_mix_a, 0, _140_two_mix_ha }, + { "mor", 7, _140_two_mor_a, 0, _140_two_mor_ha }, + { "mug", 7, _140_two_mug_a, 0, _140_two_mug_ha }, + { "rep", 7, _140_two_rep_a, 0, _140_two_rep_ha }, + { "rip", 7, _140_two_rip_a, 0, _140_two_rip_ha }, + { "rsh", 7, _140_two_rsh_a, 0, _140_two_rsh_ha }, + { "swp", 7, _140_two_swp_a, 0, _140_two_swp_ha }, + + { "flop", 7, _140_two_flop_a, 0, _140_two_flop_ha }, + { "lent", 7, _140_two_lent_a, 0, _140_two_lent_ha }, + { "levy", 7, _140_two_levy_a, 0, _140_two_levy_ha }, + { "reap", 7, _140_two_reap_a, 0, _140_two_reap_ha }, + { "slag", 7, _140_two_slag_a, 0, _140_two_slag_ha }, + { "snag", 7, _140_two_snag_a, 0, _140_two_snag_ha }, + { "turn", 7, _140_two_turn_a, 0, _140_two_turn_ha }, + { "welp", 7, _140_two_welp_a, 0, _140_two_welp_ha }, + + { "by", 7, 0, _a50_two__by_d, _140_two__by_ha }, + { "in", 7, 0, _a50_two__in_d, _140_two__in_ha }, + {} +}; + +extern u3j_core _k137_d[]; +extern u3j_core _k136_d[]; + +static u3j_core _d[] = +{ { "k140", 0, 0, _k140_d, _k140_ha, 0, (u3j_core*) 140, 0 }, + { "k139", 0, 0, _k139_d, no_hashes, 0, (u3j_core*) 139, 0 }, + { "k138", 0, 0, _k138_d, no_hashes, 0, (u3j_core*) 138, 0 }, + { "k137", 0, 0, _k137_d, no_hashes, 0, (u3j_core*) 137, 0 }, + { "k136", 0, 0, _k136_d, no_hashes, 0, (u3j_core*) 136, 0 }, + { "a50", 0, 0, _a50_d, _k140_ha, 0, (u3j_core*) c3__a50, 0 }, + {} +}; + +u3j_dash +u3j_Dash = { + _d, + 0, + 0 +}; + diff --git a/vere/pkg/noun/jets/w.h b/vere/pkg/noun/jets/w.h new file mode 100644 index 0000000..57d9677 --- /dev/null +++ b/vere/pkg/noun/jets/w.h @@ -0,0 +1,433 @@ +/// @file + +#ifndef U3_JETS_W_H +#define U3_JETS_W_H + +#include "types.h" + + /** Tier 1. + **/ + u3_noun u3wa_add(u3_noun); + u3_noun u3wa_dec(u3_noun); + u3_noun u3wa_div(u3_noun); + u3_noun u3wa_gte(u3_noun); + u3_noun u3wa_gth(u3_noun); + u3_noun u3wa_lte(u3_noun); + u3_noun u3wa_lth(u3_noun); + u3_noun u3wa_max(u3_noun); + u3_noun u3wa_min(u3_noun); + u3_noun u3wa_mod(u3_noun); + u3_noun u3wa_mul(u3_noun); + u3_noun u3wa_sub(u3_noun); + + /** Tier 2. + **/ + u3_noun u3wb_bind(u3_noun); + u3_noun u3wb_clap(u3_noun); + u3_noun u3wb_drop(u3_noun); + u3_noun u3wb_find(u3_noun); + u3_noun u3wb_flop(u3_noun); + u3_noun u3wb_lent(u3_noun); + u3_noun u3wb_levy(u3_noun); + u3_noun u3wb_lien(u3_noun); + u3_noun u3wb_murn(u3_noun); + u3_noun u3wb_need(u3_noun); + u3_noun u3wb_mate(u3_noun); + u3_noun u3wb_reap(u3_noun); + u3_noun u3wb_reel(u3_noun); + u3_noun u3wb_roll(u3_noun); + u3_noun u3wb_skid(u3_noun); + u3_noun u3wb_skim(u3_noun); + u3_noun u3wb_skip(u3_noun); + u3_noun u3wb_scag(u3_noun); + u3_noun u3wb_slag(u3_noun); + u3_noun u3wb_snag(u3_noun); + u3_noun u3wb_sort(u3_noun); + u3_noun u3wb_turn(u3_noun); + u3_noun u3wb_weld(u3_noun); +# define u3wb_welp u3wb_weld + u3_noun u3wb_zing(u3_noun); + + /** Tier 3. + **/ + u3_noun u3wc_aor(u3_noun); + u3_noun u3wc_bex(u3_noun); + u3_noun u3wc_xeb(u3_noun); + u3_noun u3wc_can(u3_noun); + u3_noun u3wc_cap(u3_noun); + u3_noun u3wc_cat(u3_noun); + u3_noun u3wc_clz(u3_noun); + u3_noun u3wc_con(u3_noun); + u3_noun u3wc_ctz(u3_noun); + u3_noun u3wc_cut(u3_noun); + u3_noun u3wc_dis(u3_noun); + u3_noun u3wc_dor(u3_noun); + u3_noun u3wc_dvr(u3_noun); + u3_noun u3wc_end(u3_noun); + u3_noun u3wc_gor(u3_noun); + u3_noun u3wc_ham(u3_noun); + u3_noun u3wc_hew(u3_noun); + u3_noun u3wc_lsh(u3_noun); + u3_noun u3wc_mas(u3_noun); + u3_noun u3wc_met(u3_noun); + u3_noun u3wc_mix(u3_noun); + u3_noun u3wc_mor(u3_noun); + u3_noun u3wc_mug(u3_noun); + u3_noun u3wc_muk(u3_noun); + u3_noun u3wc_peg(u3_noun); + u3_noun u3wc_pow(u3_noun); + u3_noun u3wc_rap(u3_noun); + u3_noun u3wc_rep(u3_noun); + u3_noun u3wc_rev(u3_noun); + u3_noun u3wc_rig(u3_noun); + u3_noun u3wc_rip(u3_noun); + u3_noun u3wc_rsh(u3_noun); + u3_noun u3wc_sew(u3_noun); + u3_noun u3wc_swp(u3_noun); + u3_noun u3wc_sqt(u3_noun); + + u3_noun u3wcp_ins(u3_noun); + u3_noun u3wcp_ind(u3_noun); + u3_noun u3wcp_tos(u3_noun); + u3_noun u3wcp_tod(u3_noun); + + /** Tier 4. + **/ + u3_noun u3wdb_all(u3_noun); + u3_noun u3wdb_any(u3_noun); + u3_noun u3wdb_apt(u3_noun); + u3_noun u3wdb_bif(u3_noun); + u3_noun u3wdb_del(u3_noun); + u3_noun u3wdb_dif(u3_noun); + u3_noun u3wdb_gas(u3_noun); + u3_noun u3wdb_get(u3_noun); + u3_noun u3wdb_has(u3_noun); + u3_noun u3wdb_int(u3_noun); + u3_noun u3wdb_jab(u3_noun); + u3_noun u3wdb_key(u3_noun); + u3_noun u3wdb_put(u3_noun); +# define u3wdb_tap u3wdi_tap + u3_noun u3wdb_uni(u3_noun); + u3_noun u3wdb_urn(u3_noun); +# define u3wdb_rep u3wdi_rep + u3_noun u3wdb_run(u3_noun); +# define u3wdb_wyt u3wdi_wyt + + u3_noun u3wdi_apt_140(u3_noun); + u3_noun u3wdi_apt(u3_noun); + u3_noun u3wdi_bif(u3_noun); + u3_noun u3wdi_del(u3_noun); + u3_noun u3wdi_dif(u3_noun); + u3_noun u3wdi_gas(u3_noun); + u3_noun u3wdi_has(u3_noun); + u3_noun u3wdi_int(u3_noun); + u3_noun u3wdi_put(u3_noun); + u3_noun u3wdi_rep(u3_noun); + u3_noun u3wdi_run(u3_noun); + u3_noun u3wdi_tap(u3_noun); + u3_noun u3wdi_uni(u3_noun); + u3_noun u3wdi_wyt(u3_noun); + + /** Tier 5. + **/ + u3_noun u3we_cue(u3_noun); + u3_noun u3we_jam(u3_noun); + u3_noun u3we_mat(u3_noun); + u3_noun u3we_rub(u3_noun); + u3_noun u3we_leer(u3_noun); + u3_noun u3we_lore(u3_noun); + u3_noun u3we_loss(u3_noun); + u3_noun u3we_lune(u3_noun); + u3_noun u3we_mice(u3_noun); + u3_noun u3we_mink(u3_noun); + u3_noun u3we_mole(u3_noun); + u3_noun u3we_mule(u3_noun); + u3_noun u3we_repg(u3_noun); + u3_noun u3we_rexp(u3_noun); + u3_noun u3we_trip(u3_noun); + + u3_noun u3we_scow(u3_noun); + u3_noun u3we_scot(u3_noun); + u3_noun u3we_slaw(u3_noun); + + u3_noun u3we_pfix(u3_noun); + u3_noun u3we_plug(u3_noun); + u3_noun u3we_pose(u3_noun); + u3_noun u3we_sfix(u3_noun); + + u3_noun u3wea_ecba_en(u3_noun); + u3_noun u3wea_ecba_de(u3_noun); + u3_noun u3wea_ecbb_en(u3_noun); + u3_noun u3wea_ecbb_de(u3_noun); + u3_noun u3wea_ecbc_en(u3_noun); + u3_noun u3wea_ecbc_de(u3_noun); + + u3_noun u3wea_cbca_en(u3_noun); + u3_noun u3wea_cbca_de(u3_noun); + u3_noun u3wea_cbcb_en(u3_noun); + u3_noun u3wea_cbcb_de(u3_noun); + u3_noun u3wea_cbcc_en(u3_noun); + u3_noun u3wea_cbcc_de(u3_noun); + + u3_noun u3wea_siva_en(u3_noun); + u3_noun u3wea_siva_de(u3_noun); + u3_noun u3wea_sivb_en(u3_noun); + u3_noun u3wea_sivb_de(u3_noun); + u3_noun u3wea_sivc_en(u3_noun); + u3_noun u3wea_sivc_de(u3_noun); + + u3_noun u3wea_de(u3_noun); + u3_noun u3wea_en(u3_noun); + + u3_noun u3wes_hsh(u3_noun); + u3_noun u3wes_hsl(u3_noun); + u3_noun u3wes_pbk(u3_noun); + u3_noun u3wes_pbl(u3_noun); + + u3_noun u3we_shax(u3_noun); + u3_noun u3we_shay(u3_noun); + u3_noun u3we_shas(u3_noun); + u3_noun u3we_shal(u3_noun); + u3_noun u3we_sha1(u3_noun); + + u3_noun u3we_fein_ob(u3_noun); + u3_noun u3we_fynd_ob(u3_noun); + + u3_noun u3weo_raw(u3_noun); + + u3_noun u3wee_scad(u3_noun); + u3_noun u3wee_scas(u3_noun); + u3_noun u3wee_scap(u3_noun); + + u3_noun u3wee_puck(u3_noun); + u3_noun u3wee_luck(u3_noun); + u3_noun u3wee_sign(u3_noun); + u3_noun u3wee_sign_raw(u3_noun); + u3_noun u3wee_veri(u3_noun); + u3_noun u3wee_sign_octs(u3_noun); + u3_noun u3wee_sign_octs_raw(u3_noun); + u3_noun u3wee_veri_octs(u3_noun); + u3_noun u3wee_shar(u3_noun); + u3_noun u3wee_slar(u3_noun); + u3_noun u3wee_recs(u3_noun); + u3_noun u3wee_smac(u3_noun); + u3_noun u3wee_point_neg(u3_noun); + u3_noun u3wee_point_add(u3_noun); + u3_noun u3wee_scalarmult(u3_noun); + u3_noun u3wee_scalarmult_base(u3_noun); + u3_noun u3wee_add_scalarmult_scalarmult_base(u3_noun); + u3_noun u3wee_add_double_scalarmult(u3_noun); + + u3_noun u3we_hmac(u3_noun); + + u3_noun u3we_kecc224(u3_noun); + u3_noun u3we_kecc256(u3_noun); + u3_noun u3we_kecc384(u3_noun); + u3_noun u3we_kecc512(u3_noun); + + u3_noun u3we_argon2(u3_noun); + + u3_noun u3we_blake2b(u3_noun); + u3_noun u3we_blake3_hash(u3_noun); + u3_noun u3we_blake3_chunk_output(u3_noun); + u3_noun u3we_blake3_compress(u3_noun); + + u3_noun u3we_chacha_crypt(u3_noun); + u3_noun u3we_chacha_xchacha(u3_noun); + + u3_noun u3we_adler32(u3_noun); + u3_noun u3we_crc32(u3_noun); + + u3_noun u3we_ripe(u3_noun); + + u3_noun u3we_make(u3_noun); + u3_noun u3we_sign(u3_noun); + u3_noun u3we_reco(u3_noun); + + u3_noun u3we_sosi(u3_noun); + u3_noun u3we_sove(u3_noun); + + u3_noun u3we_en_base16(u3_noun); + u3_noun u3we_de_base16(u3_noun); + + u3_noun u3we_json_de(u3_noun); + u3_atom u3we_json_en(u3_noun); + + u3_noun u3we_bend_fun(u3_noun); + u3_noun u3we_cold_fun(u3_noun); + u3_noun u3we_cook_fun(u3_noun); + u3_noun u3we_comp_fun(u3_noun); + u3_noun u3we_easy_fun(u3_noun); + u3_noun u3we_glue_fun(u3_noun); + u3_noun u3we_here_fun(u3_noun); + u3_noun u3we_just_fun(u3_noun); + u3_noun u3we_mask_fun(u3_noun); + u3_noun u3we_shim_fun(u3_noun); + u3_noun u3we_stag_fun(u3_noun); + u3_noun u3we_stew_fun(u3_noun); + u3_noun u3we_stir_fun(u3_noun); + + u3_noun u3wef_drg(u3_noun); + u3_noun u3wef_lug(u3_noun); + + u3_noun u3wer_add(u3_noun); + u3_noun u3wer_sub(u3_noun); + u3_noun u3wer_mul(u3_noun); + u3_noun u3wer_div(u3_noun); + u3_noun u3wer_sqt(u3_noun); + u3_noun u3wer_fma(u3_noun); + u3_noun u3wer_lth(u3_noun); + u3_noun u3wer_lte(u3_noun); + u3_noun u3wer_equ(u3_noun); + u3_noun u3wer_gte(u3_noun); + u3_noun u3wer_gth(u3_noun); + + u3_noun u3wet_add(u3_noun); + u3_noun u3wet_sub(u3_noun); + u3_noun u3wet_mul(u3_noun); + u3_noun u3wet_div(u3_noun); + u3_noun u3wet_sqt(u3_noun); + u3_noun u3wet_fma(u3_noun); + u3_noun u3wet_lth(u3_noun); + u3_noun u3wet_lte(u3_noun); + u3_noun u3wet_equ(u3_noun); + u3_noun u3wet_gte(u3_noun); + u3_noun u3wet_gth(u3_noun); + + u3_noun u3weq_add(u3_noun); + u3_noun u3weq_sub(u3_noun); + u3_noun u3weq_mul(u3_noun); + u3_noun u3weq_div(u3_noun); + u3_noun u3weq_sqt(u3_noun); + u3_noun u3weq_fma(u3_noun); + u3_noun u3weq_lth(u3_noun); + u3_noun u3weq_lte(u3_noun); + u3_noun u3weq_equ(u3_noun); + u3_noun u3weq_gte(u3_noun); + u3_noun u3weq_gth(u3_noun); + + u3_noun u3wes_add(u3_noun); + u3_noun u3wes_sub(u3_noun); + u3_noun u3wes_mul(u3_noun); + u3_noun u3wes_div(u3_noun); + u3_noun u3wes_sqt(u3_noun); + u3_noun u3wes_fma(u3_noun); + u3_noun u3wes_lth(u3_noun); + u3_noun u3wes_lte(u3_noun); + u3_noun u3wes_equ(u3_noun); + u3_noun u3wes_gte(u3_noun); + u3_noun u3wes_gth(u3_noun); + + u3_noun u3we_crc32(u3_noun); + u3_noun u3we_decompress_zlib(u3_noun); + u3_noun u3we_decompress_gzip(u3_noun); + + u3_noun u3we_lia_run_v1(u3_noun); + u3_noun u3we_lia_run_once(u3_noun); + + //+| %utilities + u3_noun u3we_bytestream_rip_octs(u3_noun); + u3_noun u3we_bytestream_cat_octs(u3_noun); + u3_noun u3we_bytestream_can_octs(u3_noun); + //+| %navigation + u3_noun u3we_bytestream_skip_line(u3_noun); + u3_noun u3we_bytestream_find_byte(u3_noun); + u3_noun u3we_bytestream_seek_byte(u3_noun); + //+| %read-byte + u3_noun u3we_bytestream_read_byte(u3_noun); + //+| %read-octs + u3_noun u3we_bytestream_read_octs(u3_noun); + //+| %transformation + u3_noun u3we_bytestream_chunk(u3_noun); + u3_noun u3we_bytestream_extract(u3_noun); + u3_noun u3we_bytestream_fuse_extract(u3_noun); + //+| %bitstream + u3_noun u3we_bytestream_need_bits(u3_noun); + u3_noun u3we_bytestream_drop_bits(u3_noun); + // u3_noun u3we_bytestream_skip_bits(u3_noun); + u3_noun u3we_bytestream_peek_bits(u3_noun); + u3_noun u3we_bytestream_read_bits(u3_noun); + // u3_noun u3we_bytestream_read_need_bits(u3_noun); + u3_noun u3we_bytestream_byte_bits(u3_noun); + + /** Tier 6. + **/ + u3_noun u3wf_bull(u3_noun); + u3_noun u3wf_cell(u3_noun); + u3_noun u3wf_comb(u3_noun); + u3_noun u3wf_cons(u3_noun); + u3_noun u3wf_core(u3_noun); + u3_noun u3wf_cube(u3_noun); + u3_noun u3wf_face(u3_noun); + u3_noun u3wf_fine(u3_noun); + u3_noun u3wf_fitz(u3_noun); + u3_noun u3wf_flan_139(u3_noun); + u3_noun u3wf_flay(u3_noun); + u3_noun u3wf_flip_139(u3_noun); + u3_noun u3wf_flor_139(u3_noun); + u3_noun u3wf_forq(u3_noun); + u3_noun u3wf_fork(u3_noun); + u3_noun u3wf_hint(u3_noun); + u3_noun u3wf_hike(u3_noun); + u3_noun u3wf_look(u3_noun); + u3_noun u3wf_loot(u3_noun); + + u3_noun u3wfl_bunt(u3_noun); + u3_noun u3wfl_whip(u3_noun); + + u3_noun u3wfp_hack(u3_noun); + u3_noun u3wfp_late(u3_noun); + u3_noun u3wfp_open(u3_noun); + u3_noun u3wfp_rake(u3_noun); + + u3_noun u3wfu_busk(u3_noun); + u3_noun u3wfu_crop(u3_noun); + u3_noun u3wfu_find(u3_noun); + u3_noun u3wfu_fond(u3_noun); + u3_noun u3wfu_fish(u3_noun); + u3_noun u3wfu_fuse(u3_noun); + u3_noun u3wfu_redo(u3_noun); + u3_noun u3wfu_mint(u3_noun); + u3_noun u3wfu_mull(u3_noun); + u3_noun u3wfu_nest_dext(u3_noun); + u3_noun u3wfu_peek(u3_noun); + u3_noun u3wfu_play(u3_noun); + u3_noun u3wfu_repo(u3_noun); + u3_noun u3wfu_rest(u3_noun); + + /** Tier 7. + **/ + u3_noun u3wg_plot_fax(u3_noun); + u3_noun u3wg_plot_met(u3_noun); + u3_noun u3wi_la_add(u3_noun); + u3_noun u3wi_la_sub(u3_noun); + u3_noun u3wi_la_mul(u3_noun); + u3_noun u3wi_la_div(u3_noun); + u3_noun u3wi_la_mod(u3_noun); + u3_noun u3wi_la_adds(u3_noun); + u3_noun u3wi_la_subs(u3_noun); + u3_noun u3wi_la_muls(u3_noun); + u3_noun u3wi_la_divs(u3_noun); + u3_noun u3wi_la_mods(u3_noun); + u3_noun u3wi_la_dot(u3_noun); + u3_noun u3wi_la_diag(u3_noun); + u3_noun u3wi_la_transpose(u3_noun); + u3_noun u3wi_la_cumsum(u3_noun); + u3_noun u3wi_la_argmin(u3_noun); + u3_noun u3wi_la_argmax(u3_noun); + u3_noun u3wi_la_ravel(u3_noun); + u3_noun u3wi_la_min(u3_noun); + u3_noun u3wi_la_max(u3_noun); + u3_noun u3wi_la_linspace(u3_noun); + u3_noun u3wi_la_range(u3_noun); + u3_noun u3wi_la_abs(u3_noun); + u3_noun u3wi_la_gth(u3_noun); + u3_noun u3wi_la_gte(u3_noun); + u3_noun u3wi_la_lth(u3_noun); + u3_noun u3wi_la_lte(u3_noun); + + u3_noun u3wi_la_trace(u3_noun); + u3_noun u3wi_la_mmul(u3_noun); + +#endif /* ifndef U3_JETS_W_H */ + |