mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Compare commits
763 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 32279e4128 | |||
| 06466fd2e0 | |||
| 28a1f7d143 | |||
| 69682e3d41 | |||
| f8511ecb22 | |||
| d4cd589733 | |||
| 82e289a64d | |||
| c1ed125689 | |||
| 6d8323f3c7 | |||
| c11679ad79 | |||
| 95aa92d5c4 | |||
| c1511d5f5d | |||
| e9047562a1 | |||
| 67cb987510 | |||
| 6ea3166005 | |||
| ae43ce7593 | |||
| a8b82bfae5 | |||
| e51c20888b | |||
| 1ac4148020 | |||
| 074374e28d | |||
| dc633ecae8 | |||
| 7d83e9cd27 | |||
| f81b7a3a1f | |||
| ebf66a2b80 | |||
| 9c66d4a453 | |||
| dba1dcdd25 | |||
| dc09000f01 | |||
| d41a2612f4 | |||
| c0ffc13801 | |||
| 6a9671eac7 | |||
| 2a1ea7d605 | |||
| 63580581f7 | |||
| 8ecfacefca | |||
| fa75865a33 | |||
| 97b522d778 | |||
| cfee5c2753 | |||
| 28b526cf81 | |||
| 34c5d96e86 | |||
| 859f1b3002 | |||
| 899a09152b | |||
| 72ca266ed7 | |||
| 84fb9f40f0 | |||
| 054f5b5284 | |||
| 2e8bede6ea | |||
| 2e24c94873 | |||
| 82ed1c2600 | |||
| 992bd49344 | |||
| e8a36235d8 | |||
| 5e3e75ed7b | |||
| b20418cf78 | |||
| 4c79fce665 | |||
| 7611dc8338 | |||
| d14a269f49 | |||
| ecea3f2531 | |||
| 6fad067ded | |||
| 1b7f2fb175 | |||
| 990e18ad59 | |||
| 7144eab350 | |||
| e9904ddb2a | |||
| 24eca2e50b | |||
| e9237f444a | |||
| 5311d1aa1b | |||
| ae8dcb82ba | |||
| 89d4e8c851 | |||
| 38c7936c94 | |||
| 93d842e045 | |||
| c0b5bc4ae8 | |||
| 88571052e8 | |||
| 34346e75a4 | |||
| 645a464b2d | |||
| fdea7924fe | |||
| b7949e81d7 | |||
| cb54138b81 | |||
| 73c8330cbd | |||
| 658d5a51ac | |||
| eabe2d96e2 | |||
| bef7eea468 | |||
| b01eb03d2a | |||
| fab3dfc145 | |||
| 5a258f0872 | |||
| abd26b7ca6 | |||
| 7be67d3acf | |||
| 72689b0b9c | |||
| 7e74dbeed3 | |||
| c36b212fa9 | |||
| a66c685c81 | |||
| 6de4df3b31 | |||
| 9c2af6aaed | |||
| 073a4f19f8 | |||
| c5e3cbe4bf | |||
| 7ac0b60255 | |||
| ca9e8d91e4 | |||
| 7b74d22310 | |||
| 4f1c1c16da | |||
| 42308c42b5 | |||
| 568309b25a | |||
| aaa0f124c3 | |||
| ef8b0b7ed8 | |||
| ad4c35b022 | |||
| 7f1ae1c344 | |||
| 90ec09a716 | |||
| 87453fb70b | |||
| 9eae7df26e | |||
| e8da16cdf5 | |||
| 02f189cebc | |||
| f5bc82f267 | |||
| b52870b4c6 | |||
| 9da0c7e1a4 | |||
| 9af6264d6b | |||
| ccdd81eb69 | |||
| fdef59b3a1 | |||
| 53a8472e5e | |||
| f2dc76e3b5 | |||
| f6cbf6ac1a | |||
| 9c1c9ba8e5 | |||
| 956379928c | |||
| 698da0982f | |||
| ee7ea34b10 | |||
| 91b4da3a2b | |||
| 9959d4fc66 | |||
| a94005b740 | |||
| 2e881d3297 | |||
| 431d9d8a12 | |||
| 76d0ff9a45 | |||
| 8e6f4a79a8 | |||
| df1d397da5 | |||
| 5084716e6b | |||
| d5a69ac8c7 | |||
| e41bbaa67a | |||
| eb906bd4c1 | |||
| 1dec82d82f | |||
| 4fd63cfb9d | |||
| 82f6facaad | |||
| 1bb77170ec | |||
| 9e50d67fe7 | |||
| 52ac930af3 | |||
| 587d93d5a5 | |||
| bc012deef9 | |||
| 7db4050040 | |||
| 8c068c57c8 | |||
| 1e3d47760f | |||
| 8708186692 | |||
| c99b67db65 | |||
| c080d16150 | |||
| 571cb54f38 | |||
| ccf37b00aa | |||
| 8284234229 | |||
| 0b25c9d224 | |||
| 4ae0bacc6e | |||
| 552944b34e | |||
| bbd5701617 | |||
| c1feb41828 | |||
| ac73793a8f | |||
| 41cce1561f | |||
| 7a08c7042f | |||
| f85a3aff2b | |||
| 279e100ad5 | |||
| bba659f174 | |||
| 461c97225e | |||
| e7e47bb683 | |||
| 0443f14fd0 | |||
| 8ad825dc3b | |||
| 0b8daabf27 | |||
| fe6f9faba4 | |||
| 2b9287dbc4 | |||
| 9b0d516310 | |||
| 3c5aa936c7 | |||
| 10d4a4278e | |||
| 9553284480 | |||
| 88bc8c9144 | |||
| 782fd7e014 | |||
| dec81fde4a | |||
| 244156af2a | |||
| db20a19711 | |||
| a83d7d3510 | |||
| 4656ea5ccd | |||
| 56a46cdff5 | |||
| c22fbb2aa7 | |||
| 3e20c5c9b3 | |||
| 4c696ed9e3 | |||
| 1321e33f08 | |||
| deae227dff | |||
| 3277cc9ce1 | |||
| 717f91e5c6 | |||
| fae8e55396 | |||
| 64e08c6d99 | |||
| 5d53c2b951 | |||
| a538837fb1 | |||
| e7828bac4d | |||
| 42a621b42e | |||
| 66ce1c03f4 | |||
| 097681b4d4 | |||
| 861f8bdfa9 | |||
| 49f86f19b2 | |||
| 735fa246bf | |||
| 298155d59e | |||
| 903ffb1584 | |||
| 24ac7a547a | |||
| 83d12f8d52 | |||
| b9536ea35f | |||
| 771b56c796 | |||
| 67f1f0997c | |||
| 10aab4cc1b | |||
| d298da8e72 | |||
| 0e98508c33 | |||
| 4c7fab6126 | |||
| d55cec41eb | |||
| 0ac917e228 | |||
| a80f394d97 | |||
| 629a6839fd | |||
| f65229d103 | |||
| 7d3679dfc8 | |||
| 5705d884ce | |||
| c805d4dbba | |||
| 2e3b482aa9 | |||
| 15bb6a9f9b | |||
| 8a538c40c0 | |||
| 2db80b81c9 | |||
| 9ee7edc1ac | |||
| ed30e2e568 | |||
| 0730bda60e | |||
| 384d0e2d21 | |||
| 393aaada64 | |||
| b064d7e547 | |||
| ec3baece4f | |||
| 75e8a72649 | |||
| 8afb73f3e2 | |||
| 52082ba399 | |||
| 40f08e22f1 | |||
| 38113d2524 | |||
| 39d805e1da | |||
| 3ce5f2df8b | |||
| 7112db9fba | |||
| 7ac536e3ca | |||
| 74949b3e7e | |||
| 078b5ccaff | |||
| 4810706ccc | |||
| f041d3a5d5 | |||
| e8254eda42 | |||
| 4fe8b074bb | |||
| 44b5153360 | |||
| 22e74a7ee5 | |||
| 9b90fd4f60 | |||
| 9f840e111a | |||
| 0f69e93664 | |||
| 117fcfc8e9 | |||
| e1c96b709a | |||
| d8ad654460 | |||
| d708931b10 | |||
| 25f360803c | |||
| 5eddccf89a | |||
| d7b2e3ab14 | |||
| e8841fbf58 | |||
| acf5b74daa | |||
| 9914243d68 | |||
| 0eef05cc00 | |||
| 159ff5b28d | |||
| 1578f4bb99 | |||
| 4cf810e4ea | |||
| f893c18088 | |||
| 792459e63d | |||
| a20fbe54b9 | |||
| a67f32561f | |||
| 301bcc636e | |||
| a17fdb7481 | |||
| b85b6822b2 | |||
| 0578e518e6 | |||
| 1e385692d1 | |||
| f43f2fc8f3 | |||
| 2160be7db7 | |||
| 95e09c0c95 | |||
| a16b2b0e12 | |||
| 182c06a46b | |||
| 982a378425 | |||
| 192e6e3b9f | |||
| 14a0cc4b7b | |||
| bd41dfbcb9 | |||
| 2fb478db76 | |||
| 1dbfeab2df | |||
| 58e10f16e9 | |||
| 1d7c00e920 | |||
| 83b6a63c16 | |||
| e209f0a220 | |||
| 892596d372 | |||
| 2a3af5dc67 | |||
| d53aa54e3b | |||
| 3310e10318 | |||
| 6ac6d690dd | |||
| 9051367fd8 | |||
| 4769a474a4 | |||
| 435cce7efd | |||
| c675c0cbb1 | |||
| 34e7a0ef4b | |||
| 0864f44c24 | |||
| 08a780edd6 | |||
| edf3f1226c | |||
| 9e37a490f8 | |||
| 10ed2ea03b | |||
| 9d370e0851 | |||
| 12bd395012 | |||
| 8591211494 | |||
| ceb5086eb3 | |||
| 7e865aec51 | |||
| a22ea766e2 | |||
| 5de3be1bee | |||
| a2649652f1 | |||
| 1bc8ef903e | |||
| 0af6f8ff57 | |||
| a2785a8180 | |||
| a94a8b1cf0 | |||
| bbd4edc607 | |||
| 8d2f9b3d12 | |||
| 1e1184f62d | |||
| 0542d6bad4 | |||
| 5b2056efda | |||
| 0464ca3870 | |||
| b66b67beda | |||
| 1535e031df | |||
| a5a13ad35f | |||
| 8a3d52f494 | |||
| e17f3256c6 | |||
| 5d0016186f | |||
| 0eceadd037 | |||
| e7021f190a | |||
| 05549410d9 | |||
| 2a1e3a572c | |||
| 663f936ba8 | |||
| 0876cf82ff | |||
| 14b4f5953b | |||
| 455a5689f3 | |||
| f84f129d65 | |||
| 5e7d763e91 | |||
| 95fbacb1dc | |||
| 82a48bd455 | |||
| d6d434eb3f | |||
| d4a03be96b | |||
| 2af0ff52e9 | |||
| 6f99806d5b | |||
| 316119069d | |||
| 7aa914b4d4 | |||
| c57610ad8a | |||
| 9c61c66045 | |||
| eebbc6eaa4 | |||
| af85b1fbed | |||
| aa5ffb686f | |||
| 0a4473bf64 | |||
| 0558b1abd8 | |||
| 97b60e7fb1 | |||
| 40bdd65ce6 | |||
| 70b49eaef2 | |||
| ea649e70b8 | |||
| 0c4f5a4093 | |||
| e563a3cb2c | |||
| f1d6af08cf | |||
| 38b9a25e83 | |||
| 695ad6ea95 | |||
| b2110c23a1 | |||
| a3365d8b3f | |||
| fc9fffc5b5 | |||
| 6ae6b63aaf | |||
| 849963b81e | |||
| 0713f2a840 | |||
| 113565a1c5 | |||
| 5cb0c7463b | |||
| e2bbf75d58 | |||
| 75c8ffddf5 | |||
| 89a1719a13 | |||
| fdec32a8f2 | |||
| 7f85ae2c48 | |||
| 23e9befbc0 | |||
| 853b25972e | |||
| a638a71c72 | |||
| 20552fe176 | |||
| e502fd88b9 | |||
| 7c9cb0901c | |||
| 5e4cecf766 | |||
| a04d18bb6d | |||
| 359c630d73 | |||
| 2be7cba8f5 | |||
| 347586e400 | |||
| e96d90dab2 | |||
| 7125481952 | |||
| 26659ef76c | |||
| 0d863ae85f | |||
| c99403d635 | |||
| a332ea1f67 | |||
| 50e0aad288 | |||
| 343a633fb0 | |||
| 36f2d1733b | |||
| 760ce71af0 | |||
| f14f2ae174 | |||
| 17720c9b7b | |||
| 89f7bb1056 | |||
| 39a29a7de1 | |||
| a867fb0703 | |||
| b6181ae58a | |||
| 727a2ec793 | |||
| 336b7efb41 | |||
| 8b8e186688 | |||
| b47c8b738a | |||
| 0bb08718b8 | |||
| 6958368daa | |||
| 623cda5521 | |||
| f07281a026 | |||
| 93648fc954 | |||
| 9369679e36 | |||
| 5b61407414 | |||
| 0d8545e01b | |||
| e6c89ef1f9 | |||
| ccdf75c1c2 | |||
| 8b39a7825d | |||
| afcf7fc86d | |||
| 8873229312 | |||
| 6eedf1065d | |||
| 795044f82c | |||
| e84060a900 | |||
| f813b5d1d8 | |||
| aecaaf011f | |||
| 0a6e1c0ffe | |||
| c0c4219b25 | |||
| bba2fd84ea | |||
| e4e3740688 | |||
| a02894afa3 | |||
| 0ffe9b987a | |||
| 6ac10a01e4 | |||
| a7bee69452 | |||
| 7f887f1928 | |||
| 8914c2318c | |||
| fb727a169f | |||
| bcb5674676 | |||
| 2ad3f0e34b | |||
| 9040baa270 | |||
| 2b3ecef66c | |||
| 9bc9ff771d | |||
| 05f4831751 | |||
| eeab289f87 | |||
| de69190df5 | |||
| e05ac91217 | |||
| f50e40f291 | |||
| 0295e6a688 | |||
| 8e579e6552 | |||
| ed5fbb5d63 | |||
| f80192e8ac | |||
| c2f3f103bb | |||
| 69d33de527 | |||
| 52fb2f59d8 | |||
| 7b7ea70b84 | |||
| 53de96426a | |||
| 67187881c2 | |||
| 8f745b7728 | |||
| 2f7f797473 | |||
| 6a6c0869dc | |||
| f1a3cfbd3b | |||
| c32f7915fb | |||
| eea72ec84a | |||
| cead78b394 | |||
| 49927a7035 | |||
| 15be2a24c3 | |||
| 5ead26be3d | |||
| b10c99bb1b | |||
| 1a0c31130c | |||
| 33bd6caf31 | |||
| 03a42b52ee | |||
| cd276715f8 | |||
| f210d3b106 | |||
| ac0e157b89 | |||
| de0779d6ca | |||
| 3d5cc1ab8f | |||
| 2217201603 | |||
| 568a7edf1f | |||
| feb07d1d1a | |||
| d3f030f02a | |||
| e545ec3810 | |||
| 599982454e | |||
| 727d83c118 | |||
| 5a4c319dd8 | |||
| eb4c7d0edf | |||
| 44f9fa1b61 | |||
| e570ca82a8 | |||
| 04a120f7c2 | |||
| 9033191efa | |||
| 5fab261d8a | |||
| 63e170170e | |||
| db3774ea45 | |||
| d63115a0f1 | |||
| 9b4046f479 | |||
| 3409c1f309 | |||
| 28a29c6da1 | |||
| ab0f2297ab | |||
| be722da0d1 | |||
| 12f64cc6d9 | |||
| 06a765a1c2 | |||
| 5956496267 | |||
| 077d8ad514 | |||
| 19b2c1c73d | |||
| 7fd3108201 | |||
| 7154526c04 | |||
| ad318e55c0 | |||
| b488f197c5 | |||
| abd1222089 | |||
| 5c19b259e4 | |||
| 70cc2cc173 | |||
| 5024c3453d | |||
| 68d67aee0e | |||
| 01e5f2a3c8 | |||
| 9a5a9b814f | |||
| e0194bba67 | |||
| 62e8f047b9 | |||
| f116808d80 | |||
| 49b887d75f | |||
| 2810491587 | |||
| c1010624a4 | |||
| ac7e63ab3b | |||
| ceabb9cac8 | |||
| 0e00d8e224 | |||
| a959ce5755 | |||
| 0279067dc4 | |||
| 8665f88791 | |||
| 59931e95c4 | |||
| 5bc3a48ecb | |||
| dcced0016c | |||
| 73b6c6619c | |||
| 2e9ac8f448 | |||
| c981e151ae | |||
| 836bebc708 | |||
| 68c58eac91 | |||
| c80db85ed5 | |||
| 4f125a3f19 | |||
| 8af45425d0 | |||
| bb7b4b67ae | |||
| a7c96edf6f | |||
| 9822c843e9 | |||
| 00d43ad960 | |||
| 976ec87100 | |||
| 8d014e9f43 | |||
| 71e78428ea | |||
| 0df3e68a5d | |||
| 5cb2764279 | |||
| 93e07eec1c | |||
| d3128ce58a | |||
| c3ba76794f | |||
| 0f2c1caa96 | |||
| 64536b866b | |||
| d0653ca908 | |||
| 27a14f0a9a | |||
| 761816bf8a | |||
| 956d0c5127 | |||
| 31c99eb99b | |||
| ce86040a0f | |||
| 9e4b3af553 | |||
| b4d7b269b0 | |||
| 17abe548a7 | |||
| b90f59d36e | |||
| b46a852acb | |||
| 35a3bab369 | |||
| 8e9da2130f | |||
| 730cbe7c0c | |||
| 19a2145204 | |||
| 6467488854 | |||
| e9756c77ea | |||
| ebdb03b4d4 | |||
| 8171edc4eb | |||
| 076520cac1 | |||
| 90e3022936 | |||
| b486a3c425 | |||
| 7082e95fa2 | |||
| b44d757b8c | |||
| 76df8d737d | |||
| 5265e35ad2 | |||
| 3d2cf0d9bf | |||
| 65897145aa | |||
| 875e0b0b59 | |||
| dd453080e0 | |||
| f0d6674352 | |||
| 73b2e0bf76 | |||
| c6e7dfe9e5 | |||
| 96190dba59 | |||
| bcce4b7141 | |||
| 2de602b869 | |||
| eaaa474630 | |||
| a3fc6ae53c | |||
| 6629112291 | |||
| e76525568a | |||
| 58a83f3b9a | |||
| 85aefa8992 | |||
| d482eabfa2 | |||
| 62c52d5a28 | |||
| 35cedfb400 | |||
| 01b03d852f | |||
| f1568af0d2 | |||
| 1f5a4d5386 | |||
| 553f9ba802 | |||
| fbb3a2426f | |||
| ddb2240b5e | |||
| b885d7387d | |||
| 0f63551def | |||
| f4cff664e6 | |||
| 3e7ced5d63 | |||
| 0bbfec3e8b | |||
| 11af5db1c3 | |||
| 3ef41672ab | |||
| 910afdc691 | |||
| 5914d9e9d4 | |||
| bf9a2501d1 | |||
| bdbc613ccb | |||
| feabcfe29e | |||
| 501b22a2ac | |||
| 979e8602dd | |||
| 66ca9722b6 | |||
| 88ae5e8cf8 | |||
| 495845443c | |||
| 35e2779575 | |||
| 0c8404a3e2 | |||
| 1c765dc37a | |||
| f6c9191cd0 | |||
| db11e07497 | |||
| 2675477f07 | |||
| 800cb15fc3 | |||
| de70014643 | |||
| 62a8ea7113 | |||
| 3f7ea47ec1 | |||
| 4fc69ce3bc | |||
| 0d07af104b | |||
| 2d975d59ce | |||
| 6915e75207 | |||
| da2cfa62f4 | |||
| 0906cd7593 | |||
| 8d1192f8a2 | |||
| ccca6ec458 | |||
| 9a1e6760a8 | |||
| f7cbb319cb | |||
| 33320b08bb | |||
| 7327ca898c | |||
| dd0a9e8970 | |||
| 9cf49d08b4 | |||
| 924d605712 | |||
| 0edb616f51 | |||
| a8d840da19 | |||
| 938ad70e1e | |||
| 1432baec1d | |||
| c474ae8cc4 | |||
| 629d81f57b | |||
| 894ce40797 | |||
| 90e53cad39 | |||
| 7f79ca2cf6 | |||
| 927a9df453 | |||
| c212edec5f | |||
| fc4fe48a00 | |||
| 13cd0e5585 | |||
| e62d672ef3 | |||
| 01233f70bd | |||
| c71408bc0a | |||
| 7096d277da | |||
| da8c23524f | |||
| 2f0265d078 | |||
| 9a3199cadd | |||
| a3b84fbb08 | |||
| b1d0a3d3aa | |||
| e5de08b692 | |||
| bcd595ad1b | |||
| f1ffedc3fa | |||
| 18158c96f5 | |||
| 840953b55a | |||
| ddaf3bdc0f | |||
| f4c4809750 | |||
| 9c9be44a98 | |||
| 38d5ed44e1 | |||
| 45ee9cc404 | |||
| 42d3efee1c | |||
| 011edf6e99 | |||
| 5237b2cccc | |||
| 0e51da81bb | |||
| a956ef35a4 | |||
| 9c6848a594 | |||
| 0529f5fc31 | |||
| 321cfe9760 | |||
| 31c1b7bc78 | |||
| 84a4d340a6 | |||
| d86c4a795d | |||
| d7f4af04ca | |||
| bdf39fe4af | |||
| 0d35fe072e | |||
| a874b80dae | |||
| 2559c93b2b | |||
| 47dcb393ca | |||
| 396ca2809f | |||
| 92ca93c885 | |||
| b59832ed26 | |||
| d86f4d220f | |||
| 5dd0f74ecf | |||
| ee599b25c1 | |||
| f8a66c88b8 | |||
| d4dd75b82c | |||
| 46e42b38f0 | |||
| 82c67d52fc | |||
| 1ab3da6f08 | |||
| 2c046eb512 | |||
| d8d1fe27f6 | |||
| 43922a5bf9 | |||
| a21edf75ad | |||
| aecbdf72bf | |||
| d4cb136deb | |||
| 76157c5f78 | |||
| 7cbe6894b4 | |||
| 78137f31c8 | |||
| 431f83eb8c | |||
| 515b2fd144 | |||
| 2768fd62a0 | |||
| 235aaafef2 | |||
| 4384a87516 | |||
| 58aefd6010 | |||
| ea0e8f7ea4 | |||
| 7c7ed3c27a | |||
| 11513bae43 | |||
| 3d996a84cc | |||
| 0e9a71e50a | |||
| 7fd7409bf2 | |||
| aac2fd7055 | |||
| c020d8507e | |||
| 4f9caea891 | |||
| 2adb1043f4 | |||
| b4c936b533 | |||
| 49709a65c7 | |||
| bed7a79add | |||
| 7373b63919 | |||
| 07a7d2a6cb | |||
| 8af0aa4905 | |||
| fc53cd20b6 | |||
| 75bdb4e0ec | |||
| 8a2bb9eb93 | |||
| 5189d73d6d | |||
| a93807f48f | |||
| 0898ce982e | |||
| 78141d17f1 | |||
| a25755060c | |||
| 6ca1b8e4e7 | |||
| 7e607c67f2 | |||
| 1e122f7887 | |||
| acecee0da1 | |||
| 1273c04e26 | |||
| 8c8bbd94dc | |||
| f5a7b6aad2 | |||
| 1b299addaf | |||
| 9cda737a56 | |||
| 0a1fd07910 | |||
| ecd2d8c11e | |||
| caac15e8e1 | |||
| 2dcc7346b4 | |||
| 2bb6eeb7c0 | |||
| 5532d176e1 | |||
| 7d4200df84 | |||
| d41ea96c2a | |||
| a2e2e83012 | |||
| 12e232c006 | |||
| 52746479a3 | |||
| 7b27346386 | |||
| 78bbf75981 | |||
| 4e85e855cf | |||
| 4e5be5a288 | |||
| 37da677cc8 | |||
| d1449c2622 | |||
| d9bf3235d2 | |||
| e5108a6291 |
@@ -0,0 +1,14 @@
|
|||||||
|
.DS_Store
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.bak
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.swp
|
||||||
|
*.tmp
|
||||||
|
|
||||||
|
/.yardoc
|
||||||
|
/bin
|
||||||
|
/build
|
||||||
|
/doc/api
|
||||||
|
/doc/capi
|
||||||
+8
-18
@@ -8,37 +8,27 @@ root = true
|
|||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
indent_size = 8
|
indent_size = 2
|
||||||
indent_style = tab
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
tab_width = 8
|
tab_width = 8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[{Makefile,Makefile.*,makefile,*.mk}]
|
[{Makefile,Makefile.*,makefile,*.mk}]
|
||||||
trim_trailing_whitespace = true
|
indent_style = tab
|
||||||
#max_line_length = 80
|
#max_line_length = 80
|
||||||
|
|
||||||
[*.{c,cc,C,cxx,cpp,h,hh,H,hxx,hpp,inc,y}]
|
#[*.{c,cc,C,cxx,cpp,h,hh,H,hxx,hpp,inc,y}]
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
#max_line_length = 120
|
#max_line_length = 120
|
||||||
|
|
||||||
[{*.rb,Rakefile,rakefile,*.rake,*.gemspec,*.gembox}]
|
#[{*.rb,Rakefile,rakefile,*.rake,*.gemspec,*.gembox}]
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
#max_line_length = 120
|
#max_line_length = 120
|
||||||
|
|
||||||
# limitation to US-ASCII
|
# limitation to US-ASCII
|
||||||
[*.bat]
|
[*.bat]
|
||||||
end_of_line = crlf
|
end_of_line = crlf
|
||||||
indent_style = space
|
|
||||||
#max_line_length = 80
|
#max_line_length = 80
|
||||||
|
|
||||||
[*.{yaml,yml}]
|
#[*.{yaml,yml}]
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
|
|
||||||
[*.md]
|
#[*.md]
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
*.png binary
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
# Basic set up
|
# Basic set up
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
|
# Maintain dependencies for Ruby
|
||||||
|
- package-ecosystem: "bundler"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
# Maintain dependencies for GitHub Actions
|
# Maintain dependencies for GitHub Actions
|
||||||
- package-ecosystem: "github-actions"
|
- package-ecosystem: "github-actions"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
benchmark:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- benchmark/**/*
|
||||||
|
build:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- Makefile
|
||||||
|
- Rakefile
|
||||||
|
- build_config/**/*
|
||||||
|
- lib/**/*
|
||||||
|
- tasks/**/*
|
||||||
|
core:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- include/**/*
|
||||||
|
- mrblib/**/*
|
||||||
|
- src/**/*
|
||||||
|
- test/**/*
|
||||||
|
doc:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- CONTRIBUTING.md
|
||||||
|
- LEGAL
|
||||||
|
- LICENSE
|
||||||
|
- NEWS
|
||||||
|
- README.md
|
||||||
|
- SECURITY.md
|
||||||
|
- TODO.md
|
||||||
|
- doc/**/*
|
||||||
|
- examples/**/*
|
||||||
|
github:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- .github/**/*
|
||||||
|
mrbgems:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- mrbgems/**/*
|
||||||
|
oss-fuzz:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- oss-fuzz/**/*
|
||||||
@@ -19,5 +19,11 @@ MD025: false
|
|||||||
# MD026 no-trailing-punctuation - Trailing punctuation in heading
|
# MD026 no-trailing-punctuation - Trailing punctuation in heading
|
||||||
MD026: false
|
MD026: false
|
||||||
|
|
||||||
|
# MD033/no-inline-html - Inline HTML
|
||||||
|
MD033: false
|
||||||
|
|
||||||
# MD040 fenced-code-language - Fenced code blocks should have a language specified
|
# MD040 fenced-code-language - Fenced code blocks should have a language specified
|
||||||
MD040: false
|
MD040: false
|
||||||
|
|
||||||
|
# MD041 first-line-heading/first-line-h1 - First line in a file should be a top-level heading
|
||||||
|
MD041: false
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
extends: default
|
extends: default
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
comments:
|
||||||
|
min-spaces-from-content: 1
|
||||||
document-start: disable
|
document-start: disable
|
||||||
line-length: disable
|
line-length: disable
|
||||||
truthy: false
|
truthy: false
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ jobs:
|
|||||||
CXX: ${{ matrix.cxx }}
|
CXX: ${{ matrix.cxx }}
|
||||||
LD: ${{ matrix.cc }}
|
LD: ${{ matrix.cc }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Ruby version
|
- name: Ruby version
|
||||||
run: ruby -v
|
run: ruby -v
|
||||||
- name: Compiler version
|
- name: Compiler version
|
||||||
@@ -41,7 +42,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MRUBY_CONFIG: ci/msvc
|
MRUBY_CONFIG: ci/msvc
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Ruby version
|
- name: Ruby version
|
||||||
run: ruby -v
|
run: ruby -v
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
name: Code scanning - action
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
- dependabot/**
|
|
||||||
pull_request:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 19 * * 4'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
CodeQL-Build:
|
|
||||||
permissions:
|
|
||||||
actions: read # for github/codeql-action/init to get workflow details
|
|
||||||
contents: read # for actions/checkout to fetch code
|
|
||||||
security-events: write # for github/codeql-action/autobuild to send a status report
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
# We must fetch at least the immediate parents so that if this is
|
|
||||||
# a pull request then we can checkout the head.
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
|
||||||
# with:
|
|
||||||
# languages: go, javascript, csharp, python, cpp, java
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
# - run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# https://github.com/actions/labeler
|
||||||
|
name: Pull Request Labeler
|
||||||
|
on:
|
||||||
|
- pull_request_target
|
||||||
|
jobs:
|
||||||
|
triage:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/labeler@v5
|
||||||
|
with:
|
||||||
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
sync-labels: true
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# https://pre-commit.com/
|
||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
@@ -6,22 +7,12 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
misspell:
|
|
||||||
name: Check spelling with misspell
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check Out
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install
|
|
||||||
run: wget -O - -q https://git.io/misspell | sh -s -- -b .
|
|
||||||
- name: Run misspell
|
|
||||||
run: git ls-files --empty-directory | xargs ./misspell -error
|
|
||||||
pre-commit:
|
pre-commit:
|
||||||
name: Run pre-commit
|
name: Run pre-commit
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check Out
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install
|
- name: Install
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# https://github.com/google/oss-fuzz
|
||||||
name: CIFuzz
|
name: CIFuzz
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
permissions:
|
permissions:
|
||||||
@@ -10,16 +11,16 @@ jobs:
|
|||||||
- name: Build Fuzzers
|
- name: Build Fuzzers
|
||||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||||
with:
|
with:
|
||||||
oss-fuzz-project-name: 'mruby'
|
oss-fuzz-project-name: "mruby"
|
||||||
dry-run: false
|
dry-run: false
|
||||||
- name: Run Fuzzers
|
- name: Run Fuzzers
|
||||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||||
with:
|
with:
|
||||||
oss-fuzz-project-name: 'mruby'
|
oss-fuzz-project-name: "mruby"
|
||||||
fuzz-seconds: 600
|
fuzz-seconds: 600
|
||||||
dry-run: false
|
dry-run: false
|
||||||
- name: Upload Crash
|
- name: Upload Crash
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
name: artifacts
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# https://github.com/super-linter/super-linter
|
||||||
name: Super-Linter
|
name: Super-Linter
|
||||||
|
|
||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
@@ -8,18 +9,18 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # for actions/checkout to fetch code
|
contents: read # for actions/checkout to fetch code
|
||||||
statuses: write # for github/super-linter/slim to mark status of each linter run
|
statuses: write # for github/super-linter/slim to mark status of each linter run
|
||||||
name: Lint Code Base
|
name: Lint Code Base
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# Full git history is needed to get a proper list of changed files within `super-linter`
|
# Full git history is needed to get a proper list of changed files within `super-linter`
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Lint Code Base
|
- name: Lint Code Base
|
||||||
uses: github/super-linter/slim@v4.10.1
|
uses: super-linter/super-linter/slim@v5.7.2
|
||||||
env:
|
env:
|
||||||
ERROR_ON_MISSING_EXEC_BIT: true
|
ERROR_ON_MISSING_EXEC_BIT: true
|
||||||
VALIDATE_BASH: true
|
VALIDATE_BASH: true
|
||||||
|
|||||||
+12
-13
@@ -1,8 +1,8 @@
|
|||||||
*.lock
|
|
||||||
*.bak
|
*.bak
|
||||||
*.bc
|
*.bc
|
||||||
*.d
|
*.d
|
||||||
*.i
|
*.i
|
||||||
|
*.lock
|
||||||
*.o
|
*.o
|
||||||
*.orig
|
*.orig
|
||||||
*.pdb
|
*.pdb
|
||||||
@@ -13,25 +13,24 @@
|
|||||||
*.tmp
|
*.tmp
|
||||||
*~
|
*~
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.ccls*
|
||||||
.ccmalloc
|
.ccmalloc
|
||||||
.svn
|
.svn
|
||||||
.vscode
|
.vscode
|
||||||
.yardoc
|
.yardoc
|
||||||
.ccls*
|
|
||||||
compile_flags.txt
|
|
||||||
compile_commands.json
|
|
||||||
cscope.files
|
|
||||||
cscope.out
|
|
||||||
tags
|
|
||||||
|
|
||||||
/.git
|
/.git
|
||||||
/bin
|
|
||||||
/build
|
|
||||||
/mruby-source-*.gem
|
|
||||||
|
|
||||||
/benchmark/**/*.dat
|
/benchmark/**/*.dat
|
||||||
/benchmark/*.pdf
|
/benchmark/*.pdf
|
||||||
/benchmark/*.png
|
/benchmark/*.png
|
||||||
|
/bin
|
||||||
|
/build
|
||||||
/doc/api
|
/doc/api
|
||||||
/doc/capi
|
/doc/capi
|
||||||
|
/mruby-source-*.gem
|
||||||
|
compile_commands.json
|
||||||
|
compile_flags.txt
|
||||||
|
cscope.files
|
||||||
|
cscope.out
|
||||||
|
node_modules
|
||||||
|
tags
|
||||||
|
!Gemfile.lock
|
||||||
|
|||||||
+23
-7
@@ -3,14 +3,14 @@ default_stages: [commit, push]
|
|||||||
default_language_version:
|
default_language_version:
|
||||||
# force all unspecified Python hooks to run python3
|
# force all unspecified Python hooks to run python3
|
||||||
python: python3
|
python: python3
|
||||||
minimum_pre_commit_version: '2.18.1'
|
minimum_pre_commit_version: "2.18.1"
|
||||||
repos:
|
repos:
|
||||||
- repo: meta
|
- repo: meta
|
||||||
hooks:
|
hooks:
|
||||||
- id: identity
|
- id: identity
|
||||||
- id: check-hooks-apply
|
- id: check-hooks-apply
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.5.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- id: check-case-conflict
|
- id: check-case-conflict
|
||||||
@@ -23,20 +23,22 @@ repos:
|
|||||||
- id: detect-private-key
|
- id: detect-private-key
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: file-contents-sorter
|
- id: file-contents-sorter
|
||||||
|
args: [--unique]
|
||||||
files: ^codespell\.txt$
|
files: ^codespell\.txt$
|
||||||
- id: fix-byte-order-marker
|
- id: fix-byte-order-marker
|
||||||
|
- id: forbid-submodules
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||||
rev: v1.3.1
|
rev: v1.5.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: forbid-tabs
|
- id: forbid-tabs
|
||||||
exclude: Makefile$|Makefile\..+$|makefile$|\.mk$
|
exclude: Makefile$|Makefile\..+$|makefile$|\.mk$
|
||||||
- id: remove-tabs
|
- id: remove-tabs
|
||||||
args: [--whitespaces-count, '2']
|
args: [--whitespaces-count, "2"]
|
||||||
exclude: Makefile$|Makefile\..+$|makefile$|\.mk$
|
exclude: Makefile$|Makefile\..+$|makefile$|\.mk$
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.2.2
|
rev: v2.2.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
name: Run codespell
|
name: Run codespell
|
||||||
@@ -48,8 +50,13 @@ repos:
|
|||||||
- id: script-must-not-have-extension
|
- id: script-must-not-have-extension
|
||||||
name: Local policy is to exclude extension from all shell files
|
name: Local policy is to exclude extension from all shell files
|
||||||
types: [shell]
|
types: [shell]
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v4.0.0-alpha.8
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
exclude: ^doc/internal/opcode\.md$
|
||||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||||
rev: v0.33.0
|
rev: v0.38.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: markdownlint
|
- id: markdownlint
|
||||||
name: Run markdownlint
|
name: Run markdownlint
|
||||||
@@ -57,8 +64,17 @@ repos:
|
|||||||
entry: markdownlint -c .github/linters/.markdown-lint.yml .
|
entry: markdownlint -c .github/linters/.markdown-lint.yml .
|
||||||
types: [markdown]
|
types: [markdown]
|
||||||
files: \.(md|mdown|markdown)$
|
files: \.(md|mdown|markdown)$
|
||||||
|
- repo: https://github.com/tcort/markdown-link-check
|
||||||
|
rev: v3.11.2
|
||||||
|
hooks:
|
||||||
|
- id: markdown-link-check
|
||||||
|
name: Run markdown-link-check
|
||||||
|
description: Checks hyperlinks in Markdown files
|
||||||
|
args: [-q]
|
||||||
|
types: [markdown]
|
||||||
|
files: \.(md|mdown|markdown)$
|
||||||
- repo: https://github.com/adrienverge/yamllint
|
- repo: https://github.com/adrienverge/yamllint
|
||||||
rev: v1.28.0
|
rev: v1.33.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: yamllint
|
- id: yamllint
|
||||||
name: Run yamllint
|
name: Run yamllint
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"bracketSpacing": false
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# Authors of mruby (mruby developers)
|
# Authors of mruby (mruby developers)
|
||||||
|
|
||||||
## The List of Contributors sorted by number of commits (as of 2022-01-08 4462e3d)
|
## The List of Contributors sorted by number of commits (as of 2023-12-28 67cb987)
|
||||||
|
|
||||||
8860 Yukihiro "Matz" Matsumoto (@matz)*
|
9477 Yukihiro "Matz" Matsumoto (@matz)*
|
||||||
586 KOBAYASHI Shuji (@shuujii)
|
586 KOBAYASHI Shuji (@shuujii)
|
||||||
441 dearblue (@dearblue)*
|
533 dearblue (@dearblue)*
|
||||||
378 Daniel Bovensiepen (@bovi)*
|
378 Daniel Bovensiepen (@bovi)*
|
||||||
346 Takeshi Watanabe (@take-cheeze)*
|
346 Takeshi Watanabe (@take-cheeze)*
|
||||||
334 Masaki Muranaka (@monaka)
|
334 Masaki Muranaka (@monaka)
|
||||||
@@ -12,15 +12,15 @@
|
|||||||
234 Jun Hiroe (@suzukaze)
|
234 Jun Hiroe (@suzukaze)
|
||||||
220 Cremno (@cremno)*
|
220 Cremno (@cremno)*
|
||||||
209 Yuki Kurihara (@ksss)+
|
209 Yuki Kurihara (@ksss)+
|
||||||
|
166 John Bampton (@jbampton)
|
||||||
151 Yasuhiro Matsumoto (@mattn)*
|
151 Yasuhiro Matsumoto (@mattn)*
|
||||||
113 Carson McDonald (@carsonmcdonald)
|
113 Carson McDonald (@carsonmcdonald)
|
||||||
113 John Bampton (@jbampton)
|
|
||||||
103 Tomasz Dąbrowski (@dabroz)*
|
103 Tomasz Dąbrowski (@dabroz)*
|
||||||
84 Akira Yumiyama (@akiray03)*
|
84 Akira Yumiyama (@akiray03)*
|
||||||
84 skandhas (@skandhas)
|
84 skandhas (@skandhas)
|
||||||
|
81 Hiroshi Mimaki (@mimaki)*
|
||||||
80 Masamitsu MURASE (@masamitsu-murase)
|
80 Masamitsu MURASE (@masamitsu-murase)
|
||||||
74 Yuichiro MASUI (@masuidrive)
|
74 Yuichiro MASUI (@masuidrive)
|
||||||
73 Hiroshi Mimaki (@mimaki)*
|
|
||||||
71 Tatsuhiko Kubo (@cubicdaiya)*
|
71 Tatsuhiko Kubo (@cubicdaiya)*
|
||||||
65 Yuichiro Kaneko (@yui-knk)+
|
65 Yuichiro Kaneko (@yui-knk)+
|
||||||
64 Paolo Bosetti (@pbosetti)*
|
64 Paolo Bosetti (@pbosetti)*
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
12 Kouki Ooyatsu (kaishuu0123)*
|
12 Kouki Ooyatsu (kaishuu0123)*
|
||||||
12 NAKAMURA Usaku (@unak)*
|
12 NAKAMURA Usaku (@unak)*
|
||||||
12 RIZAL Reckordp (@Reckordp)+
|
12 RIZAL Reckordp (@Reckordp)+
|
||||||
|
12 Ray Chason (@chasonr)*
|
||||||
12 Takashi Sawanaka (@sdottaka)*
|
12 Takashi Sawanaka (@sdottaka)*
|
||||||
12 Ukrainskiy Sergey (@ukrainskiysergey)
|
12 Ukrainskiy Sergey (@ukrainskiysergey)
|
||||||
12 Xuejie "Rafael" Xiao (@xxuejie)*
|
12 Xuejie "Rafael" Xiao (@xxuejie)*
|
||||||
@@ -73,7 +74,6 @@
|
|||||||
11 takkaw (@takkaw)
|
11 takkaw (@takkaw)
|
||||||
10 Miura Hideki (@miura1729)
|
10 Miura Hideki (@miura1729)
|
||||||
10 Narihiro Nakamura (@authorNari)
|
10 Narihiro Nakamura (@authorNari)
|
||||||
10 Ray Chason (@chasonr)*
|
|
||||||
10 Yuichi Nishiwaki (@nyuichi)
|
10 Yuichi Nishiwaki (@nyuichi)
|
||||||
9 Akira Mitsui (@murasesyuka)*
|
9 Akira Mitsui (@murasesyuka)*
|
||||||
9 Frank Celler (@fceller)
|
9 Frank Celler (@fceller)
|
||||||
@@ -82,6 +82,7 @@
|
|||||||
7 Bhargava Shastry (@bshastry)*
|
7 Bhargava Shastry (@bshastry)*
|
||||||
7 Kouichi Nakanishi (@keizo042)
|
7 Kouichi Nakanishi (@keizo042)
|
||||||
7 Rubyist (@expeditiousRubyist)
|
7 Rubyist (@expeditiousRubyist)
|
||||||
|
7 SiZiOUS (@sizious)
|
||||||
7 Simon Génier (@simon-shopify)
|
7 Simon Génier (@simon-shopify)
|
||||||
7 Terence Lee (@hone)
|
7 Terence Lee (@hone)
|
||||||
7 Wataru Ashihara (@wataash)*
|
7 Wataru Ashihara (@wataash)*
|
||||||
@@ -96,6 +97,7 @@
|
|||||||
6 Kenji Okimoto (@okkez)+
|
6 Kenji Okimoto (@okkez)+
|
||||||
6 Selman ULUG (@selman)
|
6 Selman ULUG (@selman)
|
||||||
6 Yusuke Endoh (@mame)*
|
6 Yusuke Endoh (@mame)*
|
||||||
|
6 masahino (@masahino)
|
||||||
5 Chris Reuter (@suetanvil)
|
5 Chris Reuter (@suetanvil)
|
||||||
5 Davide D'Agostino (@DAddYE)
|
5 Davide D'Agostino (@DAddYE)
|
||||||
5 Eric Hodel (@drbrain)
|
5 Eric Hodel (@drbrain)
|
||||||
@@ -104,20 +106,20 @@
|
|||||||
5 Keita Obo (@ktaobo)*
|
5 Keita Obo (@ktaobo)*
|
||||||
5 Max Anselm (@silverhammermba)
|
5 Max Anselm (@silverhammermba)
|
||||||
5 Rodrigo Malizia (@rmalizia44)+
|
5 Rodrigo Malizia (@rmalizia44)+
|
||||||
5 SiZiOUS (@sizious)
|
|
||||||
5 Syohei YOSHIDA (@syohex)
|
5 Syohei YOSHIDA (@syohex)
|
||||||
5 TOMITA Masahiro (@tmtm)
|
5 TOMITA Masahiro (@tmtm)
|
||||||
5 Yurie Yamane (@yurie)+
|
5 Yurie Yamane (@yurie)+
|
||||||
5 dreamedge (@dreamedge)
|
5 dreamedge (@dreamedge)
|
||||||
5 masahino (@masahino)
|
|
||||||
5 nkshigeru (@nkshigeru)
|
5 nkshigeru (@nkshigeru)
|
||||||
5 xuejianqing (@joans321)
|
5 xuejianqing (@joans321)
|
||||||
4 Dante Catalfamo (@dantecatalfamo)
|
4 Dante Catalfamo (@dantecatalfamo)
|
||||||
4 Goro Kikuchi (@gorogit)
|
4 Goro Kikuchi (@gorogit)
|
||||||
4 Herwin Weststrate (@herwinw)
|
4 Herwin Weststrate (@herwinw)
|
||||||
|
4 Horimoto Yasuhiro (@komainu8)
|
||||||
4 Jon Moss (@maclover7)
|
4 Jon Moss (@maclover7)
|
||||||
4 Ken Muramatsu (@ken-mu)+
|
4 Ken Muramatsu (@ken-mu)+
|
||||||
4 Kohei Suzuki (@eagletmt)
|
4 Kohei Suzuki (@eagletmt)
|
||||||
|
4 Lanza (@LanzaSchneider)
|
||||||
4 Li Yazhou (@flaneur2020)
|
4 Li Yazhou (@flaneur2020)
|
||||||
4 Marcus Stollsteimer (@stomar)
|
4 Marcus Stollsteimer (@stomar)
|
||||||
4 NARUSE, Yui (@nurse)
|
4 NARUSE, Yui (@nurse)
|
||||||
@@ -132,7 +134,6 @@
|
|||||||
3 David Turnbull (@AE9RB)
|
3 David Turnbull (@AE9RB)
|
||||||
3 Franck Verrot (@franckverrot)
|
3 Franck Verrot (@franckverrot)
|
||||||
3 HASUMI Hitoshi (@hasumikin)
|
3 HASUMI Hitoshi (@hasumikin)
|
||||||
3 Horimoto Yasuhiro (@komainu8)
|
|
||||||
3 J. Mutua (@katmutua)+
|
3 J. Mutua (@katmutua)+
|
||||||
3 Jan Berdajs (@mrbrdo)
|
3 Jan Berdajs (@mrbrdo)
|
||||||
3 Jonas Minnberg (@sasq64)
|
3 Jonas Minnberg (@sasq64)
|
||||||
@@ -141,6 +142,7 @@
|
|||||||
3 Nobuhiro Iwamatsu (@iwamatsu)
|
3 Nobuhiro Iwamatsu (@iwamatsu)
|
||||||
3 Per Lundberg (@perlun)*
|
3 Per Lundberg (@perlun)*
|
||||||
3 Rob Fors (@robfors)*
|
3 Rob Fors (@robfors)*
|
||||||
|
3 Robert Rowe (@CaptainJet)
|
||||||
3 Sebastián Katzer (@katzer)*
|
3 Sebastián Katzer (@katzer)*
|
||||||
3 Shouji Kuboyama (@Shokuji)*
|
3 Shouji Kuboyama (@Shokuji)*
|
||||||
3 Shuta Kimura (@kimushu)+
|
3 Shuta Kimura (@kimushu)+
|
||||||
@@ -173,7 +175,6 @@
|
|||||||
2 Kazuhiko Yamashita (@pyama86)+
|
2 Kazuhiko Yamashita (@pyama86)+
|
||||||
2 Kazuhiro Sera (@seratch)
|
2 Kazuhiro Sera (@seratch)
|
||||||
2 Kuroda Daisuke (@dycoon)+
|
2 Kuroda Daisuke (@dycoon)+
|
||||||
2 Lanza (@LanzaSchneider)
|
|
||||||
2 Lothar Scholz (@llothar)
|
2 Lothar Scholz (@llothar)
|
||||||
2 Lukas Joeressen (@kext)
|
2 Lukas Joeressen (@kext)
|
||||||
2 Masahiro Wakame (@vvkame)+
|
2 Masahiro Wakame (@vvkame)+
|
||||||
@@ -196,11 +197,13 @@
|
|||||||
1 A-Sat (@asatou)+
|
1 A-Sat (@asatou)+
|
||||||
1 Abinoam Praxedes Marques Junior (@abinoam)
|
1 Abinoam Praxedes Marques Junior (@abinoam)
|
||||||
1 Alex Wang (@nanamiwang)+
|
1 Alex Wang (@nanamiwang)+
|
||||||
|
1 AlexDenisov (@AlexDenisov)
|
||||||
1 Andrew Nordman (@cadwallion)
|
1 Andrew Nordman (@cadwallion)
|
||||||
1 Ashish Kurmi (@boahc077)
|
1 Ashish Kurmi (@boahc077)
|
||||||
1 Atsushi Morimoto (@mynz)
|
1 Atsushi Morimoto (@mynz)
|
||||||
1 Ben A Morgan (@BenMorganIO)
|
1 Ben A Morgan (@BenMorganIO)
|
||||||
1 Benoit Daloze (@eregon)
|
1 Benoit Daloze (@eregon)
|
||||||
|
1 Colin MacKenzie IV (@sinisterchipmunk)
|
||||||
1 Daehyub Kim (@lateau)
|
1 Daehyub Kim (@lateau)
|
||||||
1 Daniel Varga (@vargad)
|
1 Daniel Varga (@vargad)
|
||||||
1 Edgar Boda-Majer (@eboda)
|
1 Edgar Boda-Majer (@eboda)
|
||||||
@@ -257,7 +260,6 @@
|
|||||||
1 Prayag Verma (@pra85)
|
1 Prayag Verma (@pra85)
|
||||||
1 Ranmocy (@ranmocy)
|
1 Ranmocy (@ranmocy)
|
||||||
1 Robert McNally (@wolfmcnally)
|
1 Robert McNally (@wolfmcnally)
|
||||||
1 Robert Rowe (@CaptainJet)
|
|
||||||
1 Ryan Scott Lewis (@RyanScottLewis)
|
1 Ryan Scott Lewis (@RyanScottLewis)
|
||||||
1 Ryo Okubo (@syucream)
|
1 Ryo Okubo (@syucream)
|
||||||
1 SAkira a.k.a. Akira Suzuki (@sakisakira)
|
1 SAkira a.k.a. Akira Suzuki (@sakisakira)
|
||||||
@@ -281,10 +283,12 @@
|
|||||||
1 Yevhen Viktorov (@yevgenko)
|
1 Yevhen Viktorov (@yevgenko)
|
||||||
1 Yoji SHIDARA (@darashi)
|
1 Yoji SHIDARA (@darashi)
|
||||||
1 Yoshiori SHOJI (@yoshiori)
|
1 Yoshiori SHOJI (@yoshiori)
|
||||||
|
1 Yuji Yokoo (@yujiyokoo)
|
||||||
1 Yukang (@chenyukang)
|
1 Yukang (@chenyukang)
|
||||||
1 Yurii Nakonechnyi (@inobelar)
|
1 Yurii Nakonechnyi (@inobelar)
|
||||||
1 Yusuke Suzuki (@Constellation)+
|
1 Yusuke Suzuki (@Constellation)+
|
||||||
1 Yusuke Tanaka (@csouls)
|
1 Yusuke Tanaka (@csouls)
|
||||||
|
1 alpha.netzilla (@alpha-netzilla)
|
||||||
1 arton (@arton)
|
1 arton (@arton)
|
||||||
1 duangsuse (@duangsuse)
|
1 duangsuse (@duangsuse)
|
||||||
1 fl0l0u (@fl0l0u)
|
1 fl0l0u (@fl0l0u)
|
||||||
|
|||||||
+70
-14
@@ -26,8 +26,8 @@ A framework for managing and maintaining multi-language `pre-commit` hooks.
|
|||||||
You need to first install `pre-commit` and then install the `pre-commit` hooks with `pre-commit install`.
|
You need to first install `pre-commit` and then install the `pre-commit` hooks with `pre-commit install`.
|
||||||
Now `pre-commit` will run automatically on git commit!
|
Now `pre-commit` will run automatically on git commit!
|
||||||
|
|
||||||
It's usually a good idea to run the hooks against all the files when adding new hooks (usually `pre-commit` will only run on the changed files during git hooks).
|
It's usually a good idea to run the hooks against all the files when adding new hooks (usually `pre-commit`
|
||||||
Use `pre-commit run --all-files` to check all files.
|
will only run on the changed files during git hooks). Use `pre-commit run --all-files` to check all files.
|
||||||
|
|
||||||
To run a single hook use `pre-commit run --all-files <hook_id>`
|
To run a single hook use `pre-commit run --all-files <hook_id>`
|
||||||
|
|
||||||
@@ -37,12 +37,16 @@ Sometimes you might need to skip one or more hooks which can be done with the `S
|
|||||||
|
|
||||||
`$ SKIP=yamllint git commit -m "foo"`
|
`$ SKIP=yamllint git commit -m "foo"`
|
||||||
|
|
||||||
For convenience, we have added `pre-commit run --all-files` and `pre-commit autoupdate`
|
For convenience, we have added `pre-commit run --all-files`, `pre-commit install` and `pre-commit autoupdate`
|
||||||
to both the Makefile and the Rakefile. Run them with:
|
to both the Makefile and the Rakefile. Run them with:
|
||||||
|
|
||||||
- `make check` or `rake check`
|
- `make check` or `rake check`
|
||||||
|
- `make checkinstall` or `rake checkinstall`
|
||||||
- `make checkupdate` or `rake checkupdate`
|
- `make checkupdate` or `rake checkupdate`
|
||||||
|
|
||||||
|
To configure `pre-commit` you can modify the config file [.pre-commit-config.yaml](.pre-commit-config.yaml).
|
||||||
|
We use [GitHub Actions](.github/workflows/lint.yml) to run `pre-commit` on every pull request.
|
||||||
|
|
||||||
### pre-commit quick links
|
### pre-commit quick links
|
||||||
|
|
||||||
- [Quick start](https://pre-commit.com/#quick-start)
|
- [Quick start](https://pre-commit.com/#quick-start)
|
||||||
@@ -50,21 +54,73 @@ to both the Makefile and the Rakefile. Run them with:
|
|||||||
- [pre-commit autoupdate](https://pre-commit.com/#pre-commit-autoupdate)
|
- [pre-commit autoupdate](https://pre-commit.com/#pre-commit-autoupdate)
|
||||||
- [Temporarily disabling hooks](https://pre-commit.com/#temporarily-disabling-hooks)
|
- [Temporarily disabling hooks](https://pre-commit.com/#temporarily-disabling-hooks)
|
||||||
|
|
||||||
## Spell Checking
|
## Docker
|
||||||
|
|
||||||
We are running [misspell](https://github.com/client9/misspell) which is mainly written in
|
We have both a `Dockerfile` and `docker-compose.yml` files in the repository root.
|
||||||
[Golang](https://golang.org/) to check spelling with [GitHub Actions](.github/workflows/lint.yml).
|
You can run these with the command line or use
|
||||||
Correct commonly misspelled English words quickly with `misspell`. You can run `misspell` locally
|
[Docker Desktop](https://www.docker.com/products/docker-desktop/).
|
||||||
against all files with:
|
|
||||||
|
|
||||||
```bash
|
The Docker image is running Debian bullseye with Ruby and Python installed.
|
||||||
find . -type f | xargs ./misspell -error
|
You can build the Docker image with:
|
||||||
|
|
||||||
|
`$ docker-compose build test`
|
||||||
|
|
||||||
|
So far we just have one service: `test`. Running the default `docker-compose`
|
||||||
|
command will create the Docker image, spin up a container and then build and
|
||||||
|
run all mruby tests.
|
||||||
|
|
||||||
|
The default `docker-compose` command is:
|
||||||
|
|
||||||
|
`$ docker-compose -p mruby run test`
|
||||||
|
|
||||||
|
You can also use Make or Rake to run the default `docker-compose`
|
||||||
|
command from above:
|
||||||
|
|
||||||
|
- `make composetest`
|
||||||
|
- `rake composetest`
|
||||||
|
|
||||||
|
List your Docker images with:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker images
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
mruby-test latest ec60f9536948 29 seconds ago 1.29GB
|
||||||
```
|
```
|
||||||
|
|
||||||
Notable `misspell` help options or flags are:
|
You can also run any custom `docker-compose` command which will override
|
||||||
|
the default. For example to run `pre-commit run --all-files` type:
|
||||||
|
|
||||||
- `-i` string: ignore the following corrections, comma separated
|
`$ docker-compose -p mruby run test pre-commit run --all-files`
|
||||||
- `-w`: Overwrite file with corrections (default is just to display)
|
|
||||||
|
For convenience, you can also run `pre-commit` with:
|
||||||
|
|
||||||
|
- `make composecheck`
|
||||||
|
- `rake composecheck`
|
||||||
|
|
||||||
|
The bonus of running `pre-commit` with `docker-compose` is that you won't need
|
||||||
|
to install `pre-commit` and the hooks on your local machine. And that also
|
||||||
|
means you won't need to install `brew`, `conda` or `pip`.
|
||||||
|
|
||||||
|
Note limitation: currently running `pre-commit` with `docker-compose` we
|
||||||
|
skip the `check-executables-have-shebangs` hook.
|
||||||
|
|
||||||
|
Two more examples of custom `docker-compose` commands are:
|
||||||
|
|
||||||
|
- `$ docker-compose -p mruby run test ls`
|
||||||
|
- `$ docker-compose -p mruby run test rake doc:api`
|
||||||
|
|
||||||
|
If you want to test using a different `docker-compose` YAML config file you
|
||||||
|
can use the `-f` flag:
|
||||||
|
|
||||||
|
`$ docker-compose -p mruby -f docker-compose.test.yml run test`
|
||||||
|
|
||||||
|
- <https://docs.docker.com/compose/>
|
||||||
|
- <https://docs.docker.com/engine/reference/commandline/cli/>
|
||||||
|
|
||||||
|
## Spell Checking
|
||||||
|
|
||||||
|
We are using `pre-commit` to run [codespell](https://github.com/codespell-project/codespell)
|
||||||
|
to check code for common misspellings. We have a small custom dictionary file [codespell.txt](codespell.txt).
|
||||||
|
|
||||||
## Coding conventions
|
## Coding conventions
|
||||||
|
|
||||||
@@ -120,7 +176,7 @@ unless there's a clear reason, e.g. the latest Ruby has changed behavior from IS
|
|||||||
### mruby API
|
### mruby API
|
||||||
|
|
||||||
- [YARD](https://yardoc.org/) - YARD is a documentation generation tool for the Ruby programming language
|
- [YARD](https://yardoc.org/) - YARD is a documentation generation tool for the Ruby programming language
|
||||||
- [yard-mruby](https://rubygems.org/gems/yard-mruby) - Document MRuby sources with YARD
|
- [yard-mruby](https://rubygems.org/gems/yard-mruby) - Document mruby sources with YARD
|
||||||
- [yard-coderay](https://rubygems.org/gems/yard-coderay) - Adds coderay syntax highlighting to YARD docs
|
- [yard-coderay](https://rubygems.org/gems/yard-coderay) - Adds coderay syntax highlighting to YARD docs
|
||||||
|
|
||||||
### C API
|
### C API
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
FROM ruby:3.2.2-bullseye
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install --no-install-recommends -y python3-pip shellcheck \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY Gemfile Gemfile.lock .pre-commit-config.yaml ./
|
||||||
|
|
||||||
|
RUN bundle install && pip3 install pre-commit && git init . && pre-commit install-hooks
|
||||||
|
|
||||||
|
COPY . .
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'rake'
|
||||||
|
gem 'yard'
|
||||||
|
gem 'yard-coderay'
|
||||||
|
gem 'yard-mruby'
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
coderay (1.1.3)
|
||||||
|
rake (13.0.6)
|
||||||
|
webrick (1.7.0)
|
||||||
|
yard (0.9.28)
|
||||||
|
webrick (~> 1.7.0)
|
||||||
|
yard-coderay (0.1.0)
|
||||||
|
coderay
|
||||||
|
yard
|
||||||
|
yard-mruby (0.3.0)
|
||||||
|
yard (~> 0.9.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
x86_64-darwin-21
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
rake
|
||||||
|
yard
|
||||||
|
yard-coderay
|
||||||
|
yard-mruby
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.10
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2010-2023 mruby developers
|
Copyright (c) 2010- mruby developers
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
|||||||
@@ -18,6 +18,18 @@ check :
|
|||||||
pre-commit run --all-files
|
pre-commit run --all-files
|
||||||
.PHONY : check
|
.PHONY : check
|
||||||
|
|
||||||
|
checkinstall :
|
||||||
|
pre-commit install
|
||||||
|
.PHONY : checkinstall
|
||||||
|
|
||||||
checkupdate :
|
checkupdate :
|
||||||
pre-commit autoupdate
|
pre-commit autoupdate
|
||||||
.PHONY : checkupdate
|
.PHONY : checkupdate
|
||||||
|
|
||||||
|
composecheck :
|
||||||
|
docker-compose -p mruby run test pre-commit run --all-files
|
||||||
|
.PHONY : composecheck
|
||||||
|
|
||||||
|
composetest :
|
||||||
|
docker-compose -p mruby run test
|
||||||
|
.PHONY : composetest
|
||||||
|
|||||||
@@ -1,64 +1,189 @@
|
|||||||
NEWS
|
NEWS
|
||||||
----
|
----
|
||||||
|
|
||||||
# User visible changes in `mruby3.2`
|
# User visible changes in `mruby3.3` from `mruby3.2`
|
||||||
|
|
||||||
|
"**_NOTE_**:" are changes to be aware of.
|
||||||
|
|
||||||
# The language
|
# The language
|
||||||
|
|
||||||
- Now `a::B = c` should evaluate `a` then `c`.
|
- aliases work properly with `super` ([2ad3f0e](https://github.com/mruby/mruby/commit/2ad3f0e))
|
||||||
- Anonymous arguments `*`, `**`, `&` can be passed for forwarding.
|
- `callee` method work differently with aliases in mruby ([f2dc76e](https://github.com/mruby/mruby/commit/f2dc76e))
|
||||||
- Multi-precision integer is available now via `mruby-bigint` gem.
|
- define `Kernel#respond_to_missing?` method ([347586e](https://github.com/mruby/mruby/commit/347586e))
|
||||||
|
- `_inspect` method (`inspect` with recursive check) is removed
|
||||||
|
([e2bbf75](https://github.com/mruby/mruby/commit/e2bbf75), [5cb0c74](https://github.com/mruby/mruby/commit/5cb0c74), [113565a](https://github.com/mruby/mruby/commit/113565a),
|
||||||
|
[0713f2a](https://github.com/mruby/mruby/commit/0713f2a), [6ae6b63](https://github.com/mruby/mruby/commit/6ae6b63), [fc9fffc](https://github.com/mruby/mruby/commit/fc9fffc))
|
||||||
|
- `__printstr__` method is removed; use `print` instead
|
||||||
|
([acecee0](https://github.com/mruby/mruby/commit/acecee0), [192e6e3](https://github.com/mruby/mruby/commit/192e6e3))
|
||||||
|
- New method `String#bytesplice` ([5274647](https://github.com/mruby/mruby/commit/5274647), [a2e2e83](https://github.com/mruby/mruby/commit/a2e2e83))
|
||||||
|
- Allow `return` in blocks to cross C boundaries ([#6125](https://github.com/mruby/mruby/pull/6125))
|
||||||
|
|
||||||
# mruby VM and bytecode
|
# Configuration
|
||||||
|
|
||||||
- `OP_ARYDUP` was renamed to `OP_ARYSPLAT`. The instruction name
|
- mruby can be built using Docker now. Try `docker-compose build` for example. ([#5961](https://github.com/mruby/mruby/pull/5961))
|
||||||
was changed but instruction number and basic behavior have not
|
- New Platform: DJGPP (MS-DOS) ([#6022](https://github.com/mruby/mruby/pull/6022))
|
||||||
changed (except that `ARYDUP nil` makes `[]`).
|
- New Platform: Nintendo Wii ([#6086](https://github.com/mruby/mruby/pull/6086))
|
||||||
|
- Improved Platform: Android ([#6013](https://github.com/mruby/mruby/pull/6013))
|
||||||
|
- Improved Platform: Dreamcast ([#6130](https://github.com/mruby/mruby/pull/6130))
|
||||||
|
- Allow tests to be disabled for specific gems; warn about disabled tests ([#6012](https://github.com/mruby/mruby/pull/6012))
|
||||||
|
- Replace `MRB_NO_DIRECT_THREADING` with `MRB_USE_VM_SWITCH_DISPATCH` ([#5902](https://github.com/mruby/mruby/pull/5902))
|
||||||
|
|
||||||
# Tools
|
# mruby memory API
|
||||||
|
|
||||||
## `mruby`
|
- `mrb_default_allocf` can be overridden by the application ([34c5d96](https://github.com/mruby/mruby/commit/34c5d96))
|
||||||
|
- `mrb_open_allocf` will be deprecated ([cfee5c2](https://github.com/mruby/mruby/commit/cfee5c2))
|
||||||
|
|
||||||
- `-b` only specifies the script is the binary. The files loaded by `-r` are not affected by the option.
|
# Changes in C API
|
||||||
- `mruby` now loads complied binary if the suffix is `.mrb`.
|
|
||||||
|
|
||||||
## `mrbc`
|
- add new error handling API functions ([8c8bbd9](https://github.com/mruby/mruby/commit/8c8bbd9))
|
||||||
|
- Add `mrb_vm_ci_env_clear()` function with `MRB_API` ([#5945](https://github.com/mruby/mruby/pull/5945))
|
||||||
|
- a new function `mrb_check_frozen_value()` ([ccdf75c](https://github.com/mruby/mruby/commit/ccdf75c))
|
||||||
|
- avoid formatting in `mrb_bug()` ([82a48bd](https://github.com/mruby/mruby/commit/82a48bd)) <br>
|
||||||
|
**_NOTE_**: If you are using it, you must give a simple string or replace it with a call to `mrb_raise()` series.
|
||||||
|
- stop using `mrbc_` prefix for compiler context ([c5e3cbe](https://github.com/mruby/mruby/commit/c5e3cbe)) <br>
|
||||||
|
The same names are provided as before, but we recommend replacing them.
|
||||||
|
- Allow `Class#allocate` to be prohibited
|
||||||
|
([#5979](https://github.com/mruby/mruby/pull/5979), [#6122](https://github.com/mruby/mruby/pull/6122), [#6123](https://github.com/mruby/mruby/pull/6123)) <br>
|
||||||
|
To disable `#allocate`, use `MRB_UNDEF_ALLOCATOR()`.
|
||||||
|
This is also automatically applied when the subclass is created, but to explicitly allow it, use `MRB_DEFINE_ALLOCATOR()`.
|
||||||
|
|
||||||
- Add `--no-optimize` option to disable optimization.
|
# Changes in mrbgems
|
||||||
|
|
||||||
# mrbgems
|
- **default.gembox**: Add mruby debugger mrdb (`mruby-bin-debugger`) ([#5966](https://github.com/mruby/mruby/pull/5966))
|
||||||
|
- **mruby-bin-config**: new options `--cxx`, `--cxxflags`, `--as`, `--asflags`, `--objc`, `--objcflags` ([#6054](https://github.com/mruby/mruby/pull/6054))
|
||||||
|
- **mruby-binding**: renamed from `mruby-binding-core` of mruby3.2 ([11af5db](https://github.com/mruby/mruby/commit/11af5db)) <br>
|
||||||
|
**_NOTE_**: If using `mruby-binding-core` of mruby 3.2, replace it with `mruby-binding`.
|
||||||
|
- **mruby-binding**: implemented `Binding#initialize_copy` method ([#5517](https://github.com/mruby/mruby/pull/5517))
|
||||||
|
- **mruby-binding**: `Kernel#binding` responds only to calls from Ruby ([#5981](https://github.com/mruby/mruby/pull/5981))
|
||||||
|
- **mruby-compar-ext**: Comparable#clamp to accept nil as arguments ([836bebc](https://github.com/mruby/mruby/commit/836bebc))
|
||||||
|
- **mruby-compiler**: add print name for identifier tokens ([d7b2e3a](https://github.com/mruby/mruby/commit/d7b2e3a))
|
||||||
|
- **mruby-data**: allow empty Data ([927a9df](https://github.com/mruby/mruby/commit/927a9df))
|
||||||
|
- **mruby-enumerator**: remove internal attribute methods `obj`, `args`, `kwd`, `meth`, `fib`. ([735fa24](https://github.com/mruby/mruby/commit/735fa24))
|
||||||
|
- **mruby-enumerator**: add Enumerator#size ([861f8bd](https://github.com/mruby/mruby/commit/861f8bd))
|
||||||
|
- **mruby-eval**: merged `mruby-binding` of mruby3.2 ([501b22a](https://github.com/mruby/mruby/commit/501b22a), [#5989](https://github.com/mruby/mruby/pull/5989)) <br>
|
||||||
|
**_NOTE_**: If using `mruby-binding` of mruby 3.2, replace it with `mruby-eval`.
|
||||||
|
- **mruby-fiber**: Add a new `mrb_fiber_new()` with `MRB_API` ([#6097](https://github.com/mruby/mruby/pull/6097))
|
||||||
|
- **mruby-fiber**: Allows calling `Fiber#resume` from C ([#6106](https://github.com/mruby/mruby/pull/6106))
|
||||||
|
- **mruby-fiber**: `Fiber#to_s` format changed ([#6105](https://github.com/mruby/mruby/pull/6105))
|
||||||
|
- **mruby-io**: add File#atime and File#ctime ([321cfe9](https://github.com/mruby/mruby/commit/321cfe9))
|
||||||
|
- **mruby-io**: Add "x" mode option for `IO.open` ([#6081](https://github.com/mruby/mruby/pull/6081))
|
||||||
|
- **mruby-io**: File.new should not take blocks ([53de964](https://github.com/mruby/mruby/commit/53de964))
|
||||||
|
- **mruby-method**: `Method#to_s` format changed ([f5bc82f](https://github.com/mruby/mruby/commit/f5bc82f), [02f189c](https://github.com/mruby/mruby/commit/02f189c))
|
||||||
|
- **mruby-numeric-ext**: `int.pow(n,m)` to take bigint as exponential ([d482eab](https://github.com/mruby/mruby/commit/d482eab))
|
||||||
|
- **mruby-pack**: support new directives `j`, `J`, `b`, `B`, `#`
|
||||||
|
([2a1e3a5](https://github.com/mruby/mruby/commit/2a1e3a5), [e7021f1](https://github.com/mruby/mruby/commit/e7021f1), [e17f325](https://github.com/mruby/mruby/commit/e17f325))
|
||||||
|
- **mruby-range-ext**: new method `Range#overlap?` ([384d0e2](https://github.com/mruby/mruby/commit/384d0e2))
|
||||||
|
- **mruby-string-ext**: Add `String#valid_encoding?` method ([eabe2d9](https://github.com/mruby/mruby/commit/eabe2d9))
|
||||||
|
- **mruby-struct**: allow empty Struct when a name is not given ([c212ede](https://github.com/mruby/mruby/commit/c212ede))
|
||||||
|
- **mruby-time**: should allow year before 1900 ([e5de08b](https://github.com/mruby/mruby/commit/e5de08b))
|
||||||
|
- **mruby-time**: support bigint to time_t if necessary ([7096d27](https://github.com/mruby/mruby/commit/7096d27))
|
||||||
|
- **mruby-time**: need to handle negative time_t ([b064d7e](https://github.com/mruby/mruby/commit/b064d7e))
|
||||||
|
|
||||||
## mruby-class-ext
|
# Changes in build system
|
||||||
|
|
||||||
- Add `Class#subclasses` method.
|
- Extended `rake install` task ([#5928](https://github.com/mruby/mruby/pull/5928)) <br>
|
||||||
- Add `Module#undefined_instance_methods` method.
|
**_NOTE_**: Due to this impact, executable files in the `mruby/bin/` directory by default are now symbolic links (batch files on Windows).
|
||||||
|
If previously relied on those executables, should be replaced with direct references to the entity created under the build directory (e.g. `mruby/build/host/bin/`).
|
||||||
|
- Encode and decode escape characters for presym ([#6011](https://github.com/mruby/mruby/pull/6011))
|
||||||
|
- Rakefile: remove default build target directories in `deep_clean` ([#6032](https://github.com/mruby/mruby/pull/6032), [1e38569](https://github.com/mruby/mruby/commit/1e38569))
|
||||||
|
|
||||||
## New bundled gems
|
# Other breaking changes
|
||||||
|
|
||||||
- mruby-errno from [https://github.com/iij/mruby-errno.git]
|
- `mrb_f_raise()` is now an internal function
|
||||||
- mruby-set from [https://github.com/yui-knk/mruby-set.git]
|
([#5923](https://github.com/mruby/mruby/pull/5923), [#6070](https://github.com/mruby/mruby/pull/6070))
|
||||||
- mruby-dir from [https://github.com/iij/mruby-dir.git]
|
- `mrb_make_exception()` is now an internal function with different parameters
|
||||||
|
([431f83e](https://github.com/mruby/mruby/commit/431f83e), [78137f3](https://github.com/mruby/mruby/commit/78137f3))
|
||||||
|
- The `File#path` method no longer uses the `#to_path` method for implicit conversion
|
||||||
|
([d86c4a7](https://github.com/mruby/mruby/commit/d86c4a7))
|
||||||
|
- stop mrb isolation for each test file ([a20fbe5](https://github.com/mruby/mruby/commit/a20fbe5))
|
||||||
|
- RBreak remembers the CI location ([#6103](https://github.com/mruby/mruby/pull/6103))
|
||||||
|
|
||||||
# CVEs
|
# Bugs Fixed
|
||||||
|
|
||||||
Following CVEs are fixed.
|
- [#5724](https://github.com/mruby/mruby/issues/5724) Rational#\*\* is missing
|
||||||
|
- [#5725](https://github.com/mruby/mruby/issues/5725) weird const_missing exceptions in mrblib code
|
||||||
|
- [#5789](https://github.com/mruby/mruby/issues/5789) No memory release of backtrace information due to stack error
|
||||||
|
- [#5932](https://github.com/mruby/mruby/issues/5932) How to create a block using the C API? mrb_yield keeps crashing!
|
||||||
|
- [#5943](https://github.com/mruby/mruby/issues/5943) TCPSocket#write is failed
|
||||||
|
- [#5944](https://github.com/mruby/mruby/issues/5944) Behavior of calling method with a hash variable
|
||||||
|
- [#5946](https://github.com/mruby/mruby/pull/5946) Don't switch constant search path from modules to Object
|
||||||
|
- [#5949](https://github.com/mruby/mruby/issues/5949) Caller appears to report wrong line when block passed and brackets omitted
|
||||||
|
- [0906cd7](https://github.com/mruby/mruby/commit/0906cd7) numeric.c: fix rounding function issues with big numbers
|
||||||
|
- [#5974](https://github.com/mruby/mruby/issues/5974) Invalid escape sequences in gem_init.c on windows
|
||||||
|
- [#5975](https://github.com/mruby/mruby/issues/5975) Equals comparison fails on extreme ends of 64-bit integers
|
||||||
|
- [#5985](https://github.com/mruby/mruby/issues/5985) Sign extension with OP_LOADI32 in get_int_operand()
|
||||||
|
- [#5986](https://github.com/mruby/mruby/issues/5986) Fix bugs in String#bytesplice
|
||||||
|
- [#5987](https://github.com/mruby/mruby/issues/5987) ~(-1 << 64) is incorrect
|
||||||
|
- [#5991](https://github.com/mruby/mruby/issues/5991) 'gets' method not working in mruby-3.2.0
|
||||||
|
- [#5994](https://github.com/mruby/mruby/pull/5994) fix typo in mrbgems/mruby-io/src/io.c
|
||||||
|
- [#5995](https://github.com/mruby/mruby/issues/5995) One seemingly unnecessary parameter is passed in the block parameters
|
||||||
|
- [#6008](https://github.com/mruby/mruby/pull/6008) Make "bintest" independent of directory
|
||||||
|
- [b47c8b7](https://github.com/mruby/mruby/commit/b47c8b7) gc.c (clear_all_old): fix a generational GC bug
|
||||||
|
- [#6029](https://github.com/mruby/mruby/issues/6029) mruby build fails under mrbgems directory
|
||||||
|
- [a264965](https://github.com/mruby/mruby/commit/a264965) mruby-os-memsize/memsize.c: fix irep size calculation
|
||||||
|
- [3310e10](https://github.com/mruby/mruby/commit/3310e10) mruby-test/mrbgem.rake: fix mrb_state handling bug
|
||||||
|
- [#6041](https://github.com/mruby/mruby/issues/6041) GC Performance may have degraded
|
||||||
|
- [#6044](https://github.com/mruby/mruby/issues/6044) Generated presym/table.h contains invalid characters
|
||||||
|
- [#6051](https://github.com/mruby/mruby/issues/6051) Null pointer dereference in mrb_addrinfo_unix_path
|
||||||
|
- [#6052](https://github.com/mruby/mruby/issues/6052) Null pointer dereference while handling the Proc class
|
||||||
|
- [#6055](https://github.com/mruby/mruby/pull/6055) Fix libmruby name for VisualC++
|
||||||
|
- [#6060](https://github.com/mruby/mruby/issues/6060) SEGFAULT Issue Related to Fiber Usage in ngx_mruby Development
|
||||||
|
- [#6061](https://github.com/mruby/mruby/issues/6061) Performance issue in String#codepoints
|
||||||
|
- [#6064](https://github.com/mruby/mruby/issues/6064) MRUBY_PACKAGE_DIR does not always have a value.
|
||||||
|
- [#6065](https://github.com/mruby/mruby/issues/6065) Null pointer dereference while handling the Proc class
|
||||||
|
- [#6066](https://github.com/mruby/mruby/issues/6066) Null pointer dereference involving Struct.new()
|
||||||
|
- [#6067](https://github.com/mruby/mruby/issues/6067) Null pointer dereference in mrb_string_value_cstr
|
||||||
|
- [#6068](https://github.com/mruby/mruby/issues/6068) Stack overflow in mrb_vm_exec
|
||||||
|
- [#6076](https://github.com/mruby/mruby/pull/6076) Fixed unwinding block that could point to invalid PC
|
||||||
|
- [#6084](https://github.com/mruby/mruby/issues/6084) Incorrect symbolic sinks in binary built on Linux
|
||||||
|
- [#6087](https://github.com/mruby/mruby/issues/6087) 'Remote branch HEAD not found in upstream origin' error on build
|
||||||
|
- [#6089](https://github.com/mruby/mruby/issues/6089) binding.eval() handles def expressions differently from CRuby
|
||||||
|
- [#6098](https://github.com/mruby/mruby/issues/6098) Fails to call superclass of wrapped method
|
||||||
|
- [#6099](https://github.com/mruby/mruby/issues/6099) `ensure` section is not executed if the function exits via a return in a proc
|
||||||
|
- [#6108](https://github.com/mruby/mruby/issues/6108) VM crashes with break
|
||||||
|
- [#6118](https://github.com/mruby/mruby/pull/6118) Fixed IO#read with buf
|
||||||
|
- [#6120](https://github.com/mruby/mruby/pull/6120) Set EBADF if check_file_descriptor() fails
|
||||||
|
- [#6126](https://github.com/mruby/mruby/pull/6126) Fixed return value of `OP_RETURN_BLK` called directly under C function
|
||||||
|
- [#6134](https://github.com/mruby/mruby/issues/6134) String#unpack1 returns an array instead of a single string
|
||||||
|
- [#6136](https://github.com/mruby/mruby/pull/6136) Fixed when combined `mrb_fiber_resume()` and `Fiber#transfer`
|
||||||
|
|
||||||
- [CVE-2022-0080](https://nvd.nist.gov/vuln/detail/CVE-2022-0080)
|
# Pull Requests (User Visible Ones)
|
||||||
- [CVE-2022-0240](https://nvd.nist.gov/vuln/detail/CVE-2022-0240)
|
|
||||||
- [CVE-2022-0326](https://nvd.nist.gov/vuln/detail/CVE-2022-0326)
|
- [#5517](https://github.com/mruby/mruby/pull/5517) Fixed local variables not separated between copied binding objects
|
||||||
- [CVE-2022-0631](https://nvd.nist.gov/vuln/detail/CVE-2022-0631)
|
- [#5902](https://github.com/mruby/mruby/pull/5902) Replace `MRB_NO_DIRECT_THREADING` with `MRB_USE_VM_SWITCH_DISPATCH`
|
||||||
- [CVE-2022-0481](https://nvd.nist.gov/vuln/detail/CVE-2022-0481)
|
- [#5923](https://github.com/mruby/mruby/pull/5923) Demotion `mrb_f_raise()` from `MRB_API`
|
||||||
- [CVE-2022-0525](https://nvd.nist.gov/vuln/detail/CVE-2022-0525)
|
- [#5928](https://github.com/mruby/mruby/pull/5928) Improved `rake install`
|
||||||
- [CVE-2022-0570](https://nvd.nist.gov/vuln/detail/CVE-2022-0570)
|
- [#5945](https://github.com/mruby/mruby/pull/5945) Avoid exposure for `REnv` objects
|
||||||
- [CVE-2022-0614](https://nvd.nist.gov/vuln/detail/CVE-2022-0614)
|
- [#5946](https://github.com/mruby/mruby/pull/5946) Don't switch constant search path from modules to Object
|
||||||
- [CVE-2022-0623](https://nvd.nist.gov/vuln/detail/CVE-2022-0623)
|
- [#5966](https://github.com/mruby/mruby/pull/5966) Update default.gembox add mruby debugger mrdb
|
||||||
- [CVE-2022-0630](https://nvd.nist.gov/vuln/detail/CVE-2022-0630)
|
- [#5979](https://github.com/mruby/mruby/pull/5979) Allow Class#allocate to be prohibited
|
||||||
- [CVE-2022-0631](https://nvd.nist.gov/vuln/detail/CVE-2022-0631)
|
- [#5981](https://github.com/mruby/mruby/pull/5981) `Kernel#binding` responds only to calls from Ruby
|
||||||
- [CVE-2022-0632](https://nvd.nist.gov/vuln/detail/CVE-2022-0632)
|
- [#5989](https://github.com/mruby/mruby/pull/5989) Integrate mruby-binding-eval into mruby-eval
|
||||||
- [CVE-2022-0717](https://nvd.nist.gov/vuln/detail/CVE-2022-0717)
|
- [#5961](https://github.com/mruby/mruby/pull/5961) Add Docker to build and run all mruby tests. Run pre-commit and generate YARD docs with Docker
|
||||||
- [CVE-2022-0890](https://nvd.nist.gov/vuln/detail/CVE-2022-0890)
|
- [#5994](https://github.com/mruby/mruby/pull/5994) fix typo in mrbgems/mruby-io/src/io.c
|
||||||
- [CVE-2022-1106](https://nvd.nist.gov/vuln/detail/CVE-2022-1106)
|
- [#6008](https://github.com/mruby/mruby/pull/6008) Make "bintest" independent of directory
|
||||||
- [CVE-2022-1212](https://nvd.nist.gov/vuln/detail/CVE-2022-1212)
|
- [#6009](https://github.com/mruby/mruby/pull/6009) Avoid adding <MRUBY_ROOT>/bintest which does not exist
|
||||||
- [CVE-2022-1276](https://nvd.nist.gov/vuln/detail/CVE-2022-1276)
|
- [#6011](https://github.com/mruby/mruby/pull/6011) Encode and decode escape characters for presym
|
||||||
- [CVE-2022-1286](https://nvd.nist.gov/vuln/detail/CVE-2022-1286)
|
- [#6012](https://github.com/mruby/mruby/pull/6012) Allow tests to be disabled for specific gems; warn about disabled tests
|
||||||
- [CVE-2022-1934](https://nvd.nist.gov/vuln/detail/CVE-2022-1934)
|
- [#6013](https://github.com/mruby/mruby/pull/6013) Fix Android toolchain
|
||||||
|
- [#6022](https://github.com/mruby/mruby/pull/6022) Build configuration for MS-DOS and DJGPP
|
||||||
|
- [#6032](https://github.com/mruby/mruby/pull/6032) Rake: update task clean to remove bin and build folders
|
||||||
|
- [#6045](https://github.com/mruby/mruby/pull/6045) Fixes escape sequence bug and enhancements in Presym scanning
|
||||||
|
- [#6054](https://github.com/mruby/mruby/pull/6054) Extends `bin/mruby-config`
|
||||||
|
- [#6055](https://github.com/mruby/mruby/pull/6055) Fix libmruby name for VisualC++
|
||||||
|
- [#6070](https://github.com/mruby/mruby/pull/6070) Demotion mrb_f_raise() in kernel.c from MRB_API too
|
||||||
|
- [#6076](https://github.com/mruby/mruby/pull/6076) Fixed unwinding block that could point to invalid PC
|
||||||
|
- [#6081](https://github.com/mruby/mruby/pull/6081) Add "x" mode option for IO.open
|
||||||
|
- [#6086](https://github.com/mruby/mruby/pull/6086) Add build config for Nintendo Wii
|
||||||
|
- [#6097](https://github.com/mruby/mruby/pull/6097) Add a new mrb_fiber_new() with MRB_API
|
||||||
|
- [#6103](https://github.com/mruby/mruby/pull/6103) RBreak remembers the CI location
|
||||||
|
- [#6105](https://github.com/mruby/mruby/pull/6105) Implement `Fiber#to_s` method
|
||||||
|
- [#6106](https://github.com/mruby/mruby/pull/6106) Ease fiber limitations
|
||||||
|
- [#6118](https://github.com/mruby/mruby/pull/6118) Fixed IO#read with buf
|
||||||
|
- [#6120](https://github.com/mruby/mruby/pull/6120) Set EBADF if check_file_descriptor() fails
|
||||||
|
- [#6122](https://github.com/mruby/mruby/pull/6122) Prohibit `Class#allocate` in a different way
|
||||||
|
- [#6123](https://github.com/mruby/mruby/pull/6123) Inherit `MRB_FL_UNDEF_ALLOCATE` in subclasses
|
||||||
|
- [#6125](https://github.com/mruby/mruby/pull/6125) Allow `OP_RETURN_BLK` to cross C boundaries
|
||||||
|
- [#6126](https://github.com/mruby/mruby/pull/6126) Fixed return value of `OP_RETURN_BLK` called directly under C function
|
||||||
|
- [#6130](https://github.com/mruby/mruby/pull/6130) `dreamcast_shelf build config`: complete overhaul
|
||||||
|
- [#6136](https://github.com/mruby/mruby/pull/6136) Fixed when combined `mrb_fiber_resume()` and `Fiber#transfer`
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
# mruby
|
<div align="center">
|
||||||
|
<p>
|
||||||
[](https://github.com/marketplace/actions/super-linter)
|
<a href="https://mruby.org/">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/1796512?s=200&v=4"
|
||||||
|
alt="The mruby programming language" title="mruby">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<h1>mruby</h1>
|
||||||
|
<a href="https://github.com/marketplace/actions/super-linter">
|
||||||
|
<img src="https://github.com/mruby/mruby/actions/workflows/super-linter.yml/badge.svg"
|
||||||
|
alt="GitHub Super-Linter">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
## What is mruby
|
## What is mruby
|
||||||
|
|
||||||
@@ -8,34 +18,34 @@ mruby is the lightweight implementation of the Ruby language complying to (part
|
|||||||
of) the [ISO standard][ISO-standard] with more recent features provided by Ruby 3.x.
|
of) the [ISO standard][ISO-standard] with more recent features provided by Ruby 3.x.
|
||||||
Also, its syntax is Ruby 3.x compatible except for pattern matching.
|
Also, its syntax is Ruby 3.x compatible except for pattern matching.
|
||||||
|
|
||||||
mruby can be linked and embedded within your application. We provide the
|
You can link and embed mruby within your application. The "mruby" interpreter
|
||||||
interpreter program "mruby", and the interactive mruby shell "mirb" as examples.
|
program and the interactive "mirb" shell are provided as examples. You can also
|
||||||
You can also compile Ruby programs into compiled byte code using the mruby
|
compile Ruby programs into compiled byte code using the "mrbc" compiler. All
|
||||||
compiler "mrbc". All those tools reside in the "bin" directory. "mrbc" is
|
these tools are located in the "bin" directory. "mrbc" can also generate
|
||||||
also able to generate compiled byte code in a C source file, see the "mrbtest"
|
compiled byte code in a C source file. See the "mrbtest" program under the
|
||||||
program under the "test" directory for an example.
|
"test" directory for an example.
|
||||||
|
|
||||||
This achievement was sponsored by the Regional Innovation Creation R&D Programs
|
This achievement was sponsored by the Regional Innovation Creation R&D Programs
|
||||||
of the Ministry of Economy, Trade and Industry of Japan.
|
of the Ministry of Economy, Trade and Industry of Japan.
|
||||||
|
|
||||||
## How to get mruby
|
## How to get mruby
|
||||||
|
|
||||||
The stable version 3.2.0 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/3.2.0.zip](https://github.com/mruby/mruby/archive/3.2.0.zip)
|
To get mruby, you can download the stable version 3.3.0 from the official mruby
|
||||||
|
GitHub repository or clone the trunk of the mruby source tree with the "git
|
||||||
|
clone" command. You can also install and compile mruby using [ruby-install](https://github.com/postmodern/ruby-install), [ruby-build](https://github.com/rbenv/ruby-build) or [rvm](https://github.com/rvm/rvm).
|
||||||
|
|
||||||
The latest development version of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/zipball/master](https://github.com/mruby/mruby/zipball/master)
|
The latest development version of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/zipball/master](https://github.com/mruby/mruby/zipball/master)
|
||||||
|
|
||||||
The trunk of the mruby source tree can be checked out with the
|
The trunk of the mruby source tree can be checked out with the
|
||||||
following command:
|
following command:
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ git clone https://github.com/mruby/mruby.git
|
$ git clone https://github.com/mruby/mruby.git
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also install and compile mruby using [ruby-install](https://github.com/postmodern/ruby-install), [ruby-build](https://github.com/rbenv/ruby-build) or [rvm](https://github.com/rvm/rvm).
|
## mruby homepage
|
||||||
|
|
||||||
## mruby home-page
|
The URL of the mruby homepage is: <https://mruby.org>.
|
||||||
|
|
||||||
The URL of the mruby home-page is: <https://mruby.org>.
|
|
||||||
|
|
||||||
## Mailing list
|
## Mailing list
|
||||||
|
|
||||||
@@ -45,7 +55,7 @@ We don't have a mailing list, but you can use [GitHub issues](https://github.com
|
|||||||
|
|
||||||
For the simplest case, type
|
For the simplest case, type
|
||||||
|
|
||||||
```
|
```console
|
||||||
rake all test
|
rake all test
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -53,27 +63,27 @@ See the [compile.md](doc/guides/compile.md) file for the detail.
|
|||||||
|
|
||||||
## Building documentation
|
## Building documentation
|
||||||
|
|
||||||
There are two sets of documentation in mruby: the mruby API (generated by yard) and C API (Doxygen and Graphviz)
|
There are two sets of documentation in mruby: the mruby API (generated by YARD) and C API (Doxygen and Graphviz)
|
||||||
|
|
||||||
To build both of them, simply go
|
To build both of them, simply go
|
||||||
|
|
||||||
```
|
```console
|
||||||
rake doc
|
rake doc
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also view them in your browser
|
You can also view them in your browser
|
||||||
|
|
||||||
```
|
```console
|
||||||
rake view_api
|
rake view_api
|
||||||
rake view_capi
|
rake view_capi
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to customize mruby (mrbgems)
|
## How to customize mruby (mrbgems)
|
||||||
|
|
||||||
mruby contains a package manager called *mrbgems*. To create extensions
|
mruby contains a package manager called "mrbgems" that you can use to create
|
||||||
in C and/or Ruby you should create a *GEM*. For a documentation of how to
|
extensions in C and/or Ruby. For a guide on how to use mrbgems, consult the
|
||||||
use mrbgems consult the file [mrbgems.md](doc/guides/mrbgems.md).
|
[mrbgems.md](doc/guides/mrbgems.md) file, and for example code, refer to the
|
||||||
For example code of how to use mrbgems look into the folder [examples/mrbgems/](examples/mrbgems).
|
[examples/mrbgems/](examples/mrbgems) folder.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
@@ -98,9 +108,8 @@ Please ask us if you want to distribute your code under another license.
|
|||||||
|
|
||||||
## How to Contribute
|
## How to Contribute
|
||||||
|
|
||||||
See the [contribution guidelines][contribution-guidelines], and then send a pull
|
To contribute to mruby, please refer to the [contribution guidelines][contribution-guidelines] and send a pull request to the [mruby GitHub repository](https://github.com/mruby/mruby).
|
||||||
request to <https://github.com/mruby/mruby>. We consider you have granted
|
By contributing, you grant non-exclusive rights to your code under the MIT License.
|
||||||
non-exclusive right to your contributed code under MIT license.
|
|
||||||
|
|
||||||
[ISO-standard]: https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579
|
[ISO-standard]: https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579
|
||||||
[contribution-guidelines]: https://github.com/mruby/mruby/blob/master/CONTRIBUTING.md
|
[contribution-guidelines]: CONTRIBUTING.md
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ load "#{MRUBY_ROOT}/tasks/presym.rake"
|
|||||||
load "#{MRUBY_ROOT}/tasks/test.rake"
|
load "#{MRUBY_ROOT}/tasks/test.rake"
|
||||||
load "#{MRUBY_ROOT}/tasks/benchmark.rake"
|
load "#{MRUBY_ROOT}/tasks/benchmark.rake"
|
||||||
load "#{MRUBY_ROOT}/tasks/doc.rake"
|
load "#{MRUBY_ROOT}/tasks/doc.rake"
|
||||||
|
load "#{MRUBY_ROOT}/tasks/install.rake"
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# generic build targets, rules
|
# generic build targets, rules
|
||||||
@@ -56,7 +57,7 @@ task :clean do
|
|||||||
rm_rf build.build_dir
|
rm_rf build.build_dir
|
||||||
rm_f build.products
|
rm_f build.products
|
||||||
end
|
end
|
||||||
puts "Cleaned up target build folder"
|
puts "Cleaned up target build directory"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "clean everything!"
|
desc "clean everything!"
|
||||||
@@ -64,35 +65,9 @@ task :deep_clean => %w[clean doc:clean] do
|
|||||||
MRuby.each_target do |build|
|
MRuby.each_target do |build|
|
||||||
rm_rf build.gem_clone_dir
|
rm_rf build.gem_clone_dir
|
||||||
end
|
end
|
||||||
puts "Cleaned up mrbgems build folder"
|
rm_rf "#{MRUBY_ROOT}/bin"
|
||||||
end
|
rm_rf "#{MRUBY_ROOT}/build"
|
||||||
|
puts "Cleaned up mrbgems build directory"
|
||||||
PREFIX = ENV['PREFIX'] || ENV['INSTALL_PREFIX'] || '/usr/local'
|
|
||||||
|
|
||||||
desc "install compiled products"
|
|
||||||
task :install => :install_bin do
|
|
||||||
if host = MRuby.targets['host']
|
|
||||||
install_D host.libmruby_static, File.join(PREFIX, "lib", File.basename(host.libmruby_static))
|
|
||||||
# install mruby.h and mrbconf.h
|
|
||||||
Dir.glob(File.join(MRUBY_ROOT, "include", "*.h")) do |src|
|
|
||||||
install_D src, File.join(PREFIX, "include", File.basename(src))
|
|
||||||
end
|
|
||||||
Dir.glob(File.join(MRUBY_ROOT, "include", "mruby", "*.h")) do |src|
|
|
||||||
install_D src, File.join(PREFIX, "include", "mruby", File.basename(src))
|
|
||||||
end
|
|
||||||
Dir.glob(File.join(File.join(MRUBY_ROOT, "build", "host", "include", "mruby", "presym", "*.h"))) do |src|
|
|
||||||
install_D src, File.join(PREFIX, "include", "mruby", "presym", File.basename(src))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "install compiled executable (on host)"
|
|
||||||
task :install_bin => :all do
|
|
||||||
if host = MRuby.targets['host']
|
|
||||||
Dir.glob(File.join(MRUBY_ROOT, "bin", "*")) do |src|
|
|
||||||
install_D src, File.join(PREFIX, "bin", File.basename(src))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "run all pre-commit hooks against all files"
|
desc "run all pre-commit hooks against all files"
|
||||||
@@ -100,7 +75,22 @@ task :check do
|
|||||||
sh "pre-commit run --all-files"
|
sh "pre-commit run --all-files"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "install the pre-commit hooks"
|
||||||
|
task :checkinstall do
|
||||||
|
sh "pre-commit install"
|
||||||
|
end
|
||||||
|
|
||||||
desc "check the pre-commit hooks for updates"
|
desc "check the pre-commit hooks for updates"
|
||||||
task :checkupdate do
|
task :checkupdate do
|
||||||
sh "pre-commit autoupdate"
|
sh "pre-commit autoupdate"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "run all pre-commit hooks against all files with docker-compose"
|
||||||
|
task :composecheck do
|
||||||
|
sh "docker-compose -p mruby run test pre-commit run --all-files"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "build and run all mruby tests with docker-compose"
|
||||||
|
task :composetest do
|
||||||
|
sh "docker-compose -p mruby run test"
|
||||||
|
end
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ We consider the following issues as vulnerabilities:
|
|||||||
- Remote code execution
|
- Remote code execution
|
||||||
- Crash caused by a valid Ruby script
|
- Crash caused by a valid Ruby script
|
||||||
|
|
||||||
We *don't* consider the following issues as vulnerabilities:
|
We _don't_ consider the following issues as vulnerabilities:
|
||||||
|
|
||||||
- Runtime C undefined behavior (including integer overflow)
|
- Runtime C undefined behavior (including integer overflow)
|
||||||
- Crash caused by misused API
|
- Crash caused by misused API
|
||||||
|
|||||||
+4
-1
@@ -4,6 +4,10 @@ shallow_clone: true
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
|
- job_name: Visual Studio 2022 64bit
|
||||||
|
visualcpp: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
|
||||||
|
appveyor_build_worker_image: Visual Studio 2022
|
||||||
|
|
||||||
- job_name: Visual Studio 2019 64bit
|
- job_name: Visual Studio 2019 64bit
|
||||||
visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
|
visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
|
||||||
appveyor_build_worker_image: Visual Studio 2019
|
appveyor_build_worker_image: Visual Studio 2019
|
||||||
@@ -38,7 +42,6 @@ init:
|
|||||||
- set PATH=C:\Ruby26-x64\bin;%PATH%
|
- set PATH=C:\Ruby26-x64\bin;%PATH%
|
||||||
- ruby --version
|
- ruby --version
|
||||||
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- set MRUBY_CONFIG=ci/msvc
|
- set MRUBY_CONFIG=ci/msvc
|
||||||
- rake -m test:build
|
- rake -m test:build
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ class Scene
|
|||||||
|
|
||||||
def render(w, h, nsubsamples)
|
def render(w, h, nsubsamples)
|
||||||
nsf = nsubsamples.to_f
|
nsf = nsubsamples.to_f
|
||||||
|
nsfs = nsf * nsf
|
||||||
h.times do |y|
|
h.times do |y|
|
||||||
w.times do |x|
|
w.times do |x|
|
||||||
rad = Vec.new(0.0, 0.0, 0.0)
|
rad = Vec.new(0.0, 0.0, 0.0)
|
||||||
@@ -288,9 +289,9 @@ class Scene
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
r = rad.x / (nsf * nsf)
|
r = rad.x / nsfs
|
||||||
g = rad.y / (nsf * nsf)
|
g = rad.y / nsfs
|
||||||
b = rad.z / (nsf * nsf)
|
b = rad.z / nsfs
|
||||||
printf("%c", clamp(r))
|
printf("%c", clamp(r))
|
||||||
printf("%c", clamp(g))
|
printf("%c", clamp(g))
|
||||||
printf("%c", clamp(b))
|
printf("%c", clamp(b))
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
MRuby::CrossBuild.new('android-arm64-v8a') do |conf|
|
MRuby::CrossBuild.new('android-arm64-v8a') do |conf|
|
||||||
params = {
|
params = {
|
||||||
:arch => 'arm64-v8a',
|
:arch => 'arm64-v8a',
|
||||||
:sdk_version => 26,
|
:sdk_version => 33,
|
||||||
:toolchain => :clang,
|
:toolchain => :clang
|
||||||
}
|
}
|
||||||
toolchain :android, params
|
toolchain :android, params
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# Requires Android NDK r13 or later.
|
|
||||||
MRuby::CrossBuild.new('android-armeabi') do |conf|
|
|
||||||
params = {
|
|
||||||
:arch => 'armeabi',
|
|
||||||
:sdk_version => 26,
|
|
||||||
:toolchain => :clang,
|
|
||||||
}
|
|
||||||
toolchain :android, params
|
|
||||||
|
|
||||||
conf.gembox 'default'
|
|
||||||
end
|
|
||||||
@@ -4,8 +4,8 @@ MRuby::CrossBuild.new('android-armeabi-v7a-neon-hard') do |conf|
|
|||||||
:arch => 'armeabi-v7a',
|
:arch => 'armeabi-v7a',
|
||||||
:mfpu => 'neon',
|
:mfpu => 'neon',
|
||||||
:mfloat_abi => 'hard',
|
:mfloat_abi => 'hard',
|
||||||
:sdk_version => 26,
|
:sdk_version => 33,
|
||||||
:toolchain => :clang,
|
:toolchain => :clang
|
||||||
}
|
}
|
||||||
toolchain :android, params
|
toolchain :android, params
|
||||||
|
|
||||||
|
|||||||
@@ -4,31 +4,31 @@
|
|||||||
# Requires KallistiOS (KOS)
|
# Requires KallistiOS (KOS)
|
||||||
# http://gamedev.allusion.net/softprj/kos/
|
# http://gamedev.allusion.net/softprj/kos/
|
||||||
#
|
#
|
||||||
# Tested on GNU/Linux, macOS and Windows (through MinGW-w64/MSYS2, Cygwin and DreamSDK).
|
# This configuration has been improved to be used as KallistiOS Port (kos-ports)
|
||||||
|
# Updated: 2023-12-24
|
||||||
|
#
|
||||||
|
# Tested on GNU/Linux, macOS and Windows (MinGW-w64/MSYS2, Cygwin, DreamSDK)
|
||||||
# DreamSDK is based on MinGW/MSYS: https://dreamsdk.org/
|
# DreamSDK is based on MinGW/MSYS: https://dreamsdk.org/
|
||||||
#
|
#
|
||||||
# Input this command on the directory where mruby is installed:
|
# Install mruby for Sega Dreamcast using the "mruby" kos-port.
|
||||||
# make MRUBY_CONFIG=dreamcast_shelf
|
|
||||||
#
|
#
|
||||||
MRuby::CrossBuild.new("dreamcast") do |conf|
|
MRuby::CrossBuild.new("dreamcast") do |conf|
|
||||||
toolchain :gcc
|
toolchain :gcc
|
||||||
|
|
||||||
# Support for DreamSDK (based on MinGW/MSYS)
|
# Getting critical environment variables
|
||||||
# To compile mruby with DreamSDK, RubyInstaller for Windows should be installed
|
KOS_BASE = ENV["KOS_BASE"]
|
||||||
DREAMSDK_HOME = ENV["DREAMSDK_HOME"]
|
KOS_CC_BASE = ENV["KOS_CC_BASE"]
|
||||||
MSYS_ROOT = !(DREAMSDK_HOME.nil? || DREAMSDK_HOME.empty?) ? "#{DREAMSDK_HOME}/msys/1.0" : ""
|
|
||||||
|
|
||||||
# Setting paths
|
if (KOS_BASE.nil? || KOS_BASE.empty? || KOS_CC_BASE.nil? || KOS_CC_BASE.empty?)
|
||||||
DREAMCAST_PATH = "#{MSYS_ROOT}/opt/toolchains/dc"
|
raise "Error: KallistiOS is required; KOS_BASE/KOS_CC_BASE needs to be declared; Stop."
|
||||||
KOS_PATH = "#{DREAMCAST_PATH}/kos"
|
end
|
||||||
BIN_PATH = "#{DREAMCAST_PATH}/sh-elf/bin"
|
|
||||||
|
|
||||||
# C compiler
|
# C compiler
|
||||||
# Flags were extracted from KallistiOS environment files
|
# All flags and settings below were extracted from KallistiOS environment files
|
||||||
conf.cc do |cc|
|
conf.cc do |cc|
|
||||||
cc.command = "#{BIN_PATH}/sh-elf-gcc"
|
cc.command = "#{KOS_CC_BASE}/bin/sh-elf-gcc"
|
||||||
cc.include_paths << ["#{KOS_PATH}/include", "#{KOS_PATH}/kernel/arch/dreamcast/include", "#{KOS_PATH}/addons/include", "#{KOS_PATH}/../kos-ports/include"]
|
cc.include_paths << ["#{KOS_BASE}/include", "#{KOS_BASE}/kernel/arch/dreamcast/include", "#{KOS_BASE}/addons/include", "#{KOS_BASE}/../kos-ports/include"]
|
||||||
cc.flags << ["-O2", "-fomit-frame-pointer", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-Wall", "-g", "-fno-builtin", "-ml", "-m4-single-only", "-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_PATH}/utils/ldscripts/shlelf.xc", "-nodefaultlibs"]
|
cc.flags << ["-O2", "-fomit-frame-pointer", "-fno-builtin", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-matomic-model=soft-imask", "-ftls-model=local-exec", "-Wall", "-g"]
|
||||||
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
|
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
|
||||||
cc.defines << %w(_arch_dreamcast)
|
cc.defines << %w(_arch_dreamcast)
|
||||||
cc.defines << %w(_arch_sub_pristine)
|
cc.defines << %w(_arch_sub_pristine)
|
||||||
@@ -39,79 +39,45 @@ MRuby::CrossBuild.new("dreamcast") do |conf|
|
|||||||
cxx.command = conf.cc.command.dup
|
cxx.command = conf.cc.command.dup
|
||||||
cxx.include_paths = conf.cc.include_paths.dup
|
cxx.include_paths = conf.cc.include_paths.dup
|
||||||
cxx.flags = conf.cc.flags.dup
|
cxx.flags = conf.cc.flags.dup
|
||||||
cxx.flags << %w(-fno-rtti -fno-exceptions)
|
cxx.flags << %w(-fno-operator-names)
|
||||||
cxx.defines = conf.cc.defines.dup
|
cxx.defines = conf.cc.defines.dup
|
||||||
cxx.compile_options = conf.cc.compile_options.dup
|
cxx.compile_options = conf.cc.compile_options.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
# Linker
|
# Linker
|
||||||
# There is an issue when making the mruby library with KallistiOS:
|
|
||||||
# 'newlib_kill.o' and 'newlib_getpid.o' aren't found so they are explicitly
|
|
||||||
# specified here at least for now.
|
|
||||||
conf.linker do |linker|
|
conf.linker do |linker|
|
||||||
linker.command="#{BIN_PATH}/sh-elf-gcc"
|
linker.command = "#{KOS_CC_BASE}/bin/sh-elf-gcc"
|
||||||
linker.flags << ["#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_kill.o", "#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_getpid.o", "-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group"]
|
linker.flags << ["-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_BASE}/utils/ldscripts/shlelf.xc", "-nodefaultlibs", "-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group"]
|
||||||
linker.library_paths << ["#{KOS_PATH}/lib/dreamcast", "#{KOS_PATH}/addons/lib/dreamcast", "#{KOS_PATH}/../kos-ports/lib"]
|
linker.library_paths << ["#{KOS_BASE}/lib/dreamcast", "#{KOS_BASE}/addons/lib/dreamcast", "#{KOS_BASE}/../kos-ports/lib"]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Archiver
|
# Archiver
|
||||||
conf.archiver do |archiver|
|
conf.archiver do |archiver|
|
||||||
archiver.command = "#{BIN_PATH}/sh-elf-ar"
|
archiver.command = "#{KOS_CC_BASE}/bin/sh-elf-ar"
|
||||||
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
|
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
|
||||||
end
|
end
|
||||||
|
|
||||||
# No executables
|
# No executables needed for KallistiOS
|
||||||
conf.bins = []
|
conf.bins = []
|
||||||
|
|
||||||
# Do not build executable test
|
# Do not build test binaries
|
||||||
conf.build_mrbtest_lib_only
|
conf.build_mrbtest_lib_only
|
||||||
|
|
||||||
# Disable C++ exception
|
# Gemboxes
|
||||||
conf.disable_cxx_exception
|
conf.gembox "default-no-stdio"
|
||||||
|
conf.gembox "stdlib-ext"
|
||||||
|
conf.gembox "metaprog"
|
||||||
|
|
||||||
# Gems from core
|
# Additional Gems
|
||||||
# Some Gems are incompatible and were disabled.
|
# Currently unsupported on KallistiOS: "mruby-io", "mruby-dir", "mruby-socket"
|
||||||
|
|
||||||
conf.gem :core => "mruby-array-ext"
|
|
||||||
conf.gem :core => "mruby-binding"
|
conf.gem :core => "mruby-binding"
|
||||||
conf.gem :core => "mruby-catch"
|
conf.gem :core => "mruby-catch"
|
||||||
conf.gem :core => "mruby-class-ext"
|
|
||||||
conf.gem :core => "mruby-cmath"
|
|
||||||
conf.gem :core => "mruby-compar-ext"
|
|
||||||
conf.gem :core => "mruby-compiler"
|
|
||||||
conf.gem :core => "mruby-complex"
|
|
||||||
conf.gem :core => "mruby-enum-chain"
|
conf.gem :core => "mruby-enum-chain"
|
||||||
conf.gem :core => "mruby-enum-ext"
|
conf.gem :core => "mruby-errno"
|
||||||
conf.gem :core => "mruby-enum-lazy"
|
|
||||||
conf.gem :core => "mruby-enumerator"
|
|
||||||
conf.gem :core => "mruby-error"
|
conf.gem :core => "mruby-error"
|
||||||
conf.gem :core => "mruby-eval"
|
|
||||||
conf.gem :core => "mruby-exit"
|
conf.gem :core => "mruby-exit"
|
||||||
conf.gem :core => "mruby-fiber"
|
|
||||||
conf.gem :core => "mruby-hash-ext"
|
|
||||||
# conf.gem :core => "mruby-io"
|
|
||||||
conf.gem :core => "mruby-kernel-ext"
|
|
||||||
conf.gem :core => "mruby-math"
|
|
||||||
conf.gem :core => "mruby-metaprog"
|
|
||||||
conf.gem :core => "mruby-method"
|
|
||||||
conf.gem :core => "mruby-numeric-ext"
|
|
||||||
conf.gem :core => "mruby-object-ext"
|
|
||||||
conf.gem :core => "mruby-objectspace"
|
|
||||||
conf.gem :core => "mruby-os-memsize"
|
conf.gem :core => "mruby-os-memsize"
|
||||||
conf.gem :core => "mruby-pack"
|
|
||||||
conf.gem :core => "mruby-print"
|
conf.gem :core => "mruby-print"
|
||||||
conf.gem :core => "mruby-proc-binding"
|
conf.gem :core => "mruby-proc-binding"
|
||||||
conf.gem :core => "mruby-proc-ext"
|
|
||||||
conf.gem :core => "mruby-random"
|
|
||||||
conf.gem :core => "mruby-range-ext"
|
|
||||||
conf.gem :core => "mruby-rational"
|
|
||||||
conf.gem :core => "mruby-sleep"
|
conf.gem :core => "mruby-sleep"
|
||||||
# conf.gem :core => "mruby-socket"
|
|
||||||
conf.gem :core => "mruby-sprintf"
|
|
||||||
conf.gem :core => "mruby-string-ext"
|
|
||||||
conf.gem :core => "mruby-struct"
|
|
||||||
conf.gem :core => "mruby-symbol-ext"
|
|
||||||
# conf.gem :core => "mruby-test"
|
|
||||||
# conf.gem :core => "mruby-time"
|
|
||||||
conf.gem :core => "mruby-toplevel-ext"
|
|
||||||
end
|
end
|
||||||
|
|||||||
+10
-10
@@ -1,23 +1,20 @@
|
|||||||
|
# NOTE: Currently, this configuration file does not support VisualC++!
|
||||||
|
# Your help is needed!
|
||||||
|
|
||||||
MRuby::Build.new do |conf|
|
MRuby::Build.new do |conf|
|
||||||
# load specific toolchain settings
|
# load specific toolchain settings
|
||||||
|
conf.toolchain
|
||||||
# Gets set by the VS command prompts.
|
|
||||||
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
|
|
||||||
toolchain :visualcpp
|
|
||||||
else
|
|
||||||
toolchain :gcc
|
|
||||||
end
|
|
||||||
|
|
||||||
# include the GEM box
|
# include the GEM box
|
||||||
conf.gembox 'default'
|
conf.gembox 'default'
|
||||||
|
|
||||||
# C compiler settings
|
# C compiler settings
|
||||||
conf.cc do |cc|
|
conf.compilers.each do |cc|
|
||||||
cc.flags = '-fPIC'
|
cc.flags << '-fPIC'
|
||||||
end
|
end
|
||||||
|
|
||||||
conf.archiver do |archiver|
|
conf.archiver do |archiver|
|
||||||
archiver.command = 'gcc'
|
archiver.command = cc.command
|
||||||
archiver.archive_options = '-shared -o %{outfile} %{objs}'
|
archiver.archive_options = '-shared -o %{outfile} %{objs}'
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29,6 +26,9 @@ MRuby::Build.new do |conf|
|
|||||||
# file separator
|
# file separator
|
||||||
# conf.file_separator = '/'
|
# conf.file_separator = '/'
|
||||||
|
|
||||||
|
# enable this if better compatibility with C++ is desired
|
||||||
|
#conf.enable_cxx_exception
|
||||||
|
|
||||||
# Turn on `enable_debug` for better debugging
|
# Turn on `enable_debug` for better debugging
|
||||||
conf.enable_debug
|
conf.enable_debug
|
||||||
conf.enable_bintest
|
conf.enable_bintest
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Cross Compiling configuration for MS-DOS
|
||||||
|
#
|
||||||
|
# Requires DJGPP cross-compiler, see
|
||||||
|
# https://github.com/andrewwutw/build-djgpp/releases
|
||||||
|
|
||||||
|
MRuby::CrossBuild.new("i586-pc-msdosdjgpp") do |conf|
|
||||||
|
toolchain :gcc
|
||||||
|
|
||||||
|
# If DJGPP is not in the PATH, set this to the bin directory
|
||||||
|
DJGPP_PATH = nil
|
||||||
|
|
||||||
|
GCC = 'i586-pc-msdosdjgpp-gcc'
|
||||||
|
GXX = 'i586-pc-msdosdjgpp-g++'
|
||||||
|
AR = 'i586-pc-msdosdjgpp-ar'
|
||||||
|
|
||||||
|
conf.cc do |cc|
|
||||||
|
cc.command = DJGPP_PATH ? File.join(DJGPP_PATH, GCC) : GCC
|
||||||
|
cc.defines << 'MRB_WITHOUT_IO_PREAD_PWRITE'
|
||||||
|
cc.defines << 'MRB_UTF8_STRING'
|
||||||
|
end
|
||||||
|
|
||||||
|
conf.cxx do |cxx|
|
||||||
|
cxx.command = DJGPP_PATH ? File.join(DJGPP_PATH, GXX) : GXX
|
||||||
|
cxx.defines << 'MRB_WITHOUT_IO_PREAD_PWRITE'
|
||||||
|
cxx.defines << 'MRB_UTF8_STRING'
|
||||||
|
end
|
||||||
|
|
||||||
|
conf.linker do |linker|
|
||||||
|
linker.command = DJGPP_PATH ? File.join(DJGPP_PATH, GXX) : GXX
|
||||||
|
linker.libraries = %w(m)
|
||||||
|
end
|
||||||
|
|
||||||
|
conf.archiver do |archiver|
|
||||||
|
archiver.command = DJGPP_PATH ? File.join(DJGPP_PATH, AR) : AR
|
||||||
|
end
|
||||||
|
|
||||||
|
# All provided gems that can be reasonably made to compile:
|
||||||
|
# default.gembox, minus mruby-socket and replacing mruby-cmath with mruby-cmath-alt
|
||||||
|
conf.gembox "stdlib"
|
||||||
|
conf.gembox "stdlib-ext"
|
||||||
|
|
||||||
|
conf.gem :core => 'mruby-io' # stdlib-io.gembox <- default.gembox
|
||||||
|
# No socket support in DJGPP
|
||||||
|
# conf.gem :core => 'mruby-socket' # stdlib-io.gembox <- default.gembox
|
||||||
|
conf.gem :core => 'mruby-print' # stdlib-io.gembox <- default.gembox
|
||||||
|
conf.gem :core => 'mruby-errno' # stdlib-io.gembox <- default.gembox
|
||||||
|
conf.gem :core => 'mruby-dir' # stdlib-io.gembox <- default.gembox
|
||||||
|
|
||||||
|
conf.gem :core => 'mruby-bigint' # math.gembox <- default.gembox
|
||||||
|
conf.gem :core => 'mruby-complex' # math.gembox <- default.gembox
|
||||||
|
conf.gem :core => 'mruby-math' # math.gembox <- default.gembox
|
||||||
|
conf.gem :core => 'mruby-rational' # math.gembox <- default.gembox
|
||||||
|
# Alternative implementation of cmath, not requiring <complex.h>
|
||||||
|
# conf.gem :github => 'chasonr/mruby-cmath-alt' # math.gembox <- default.gembox
|
||||||
|
|
||||||
|
conf.gembox "metaprog"
|
||||||
|
|
||||||
|
conf.gem :core => 'mruby-bin-mrbc' # default.gembox
|
||||||
|
conf.gem :core => 'mruby-bin-debugger' # default.gembox
|
||||||
|
conf.gem :core => 'mruby-bin-mirb' # default.gembox
|
||||||
|
conf.gem :core => 'mruby-bin-mruby' # default.gembox
|
||||||
|
conf.gem :core => 'mruby-bin-strip' # default.gembox
|
||||||
|
conf.gem :core => 'mruby-bin-config' # default.gembox
|
||||||
|
|
||||||
|
# Other compilable gems
|
||||||
|
conf.gem :core => 'mruby-binding'
|
||||||
|
conf.gem :core => 'mruby-catch'
|
||||||
|
conf.gem :core => 'mruby-enum-chain'
|
||||||
|
conf.gem :core => 'mruby-error'
|
||||||
|
conf.gem :core => 'mruby-exit'
|
||||||
|
conf.gem :core => 'mruby-os-memsize'
|
||||||
|
conf.gem :core => 'mruby-proc-binding'
|
||||||
|
conf.gem :core => 'mruby-sleep'
|
||||||
|
|
||||||
|
# For Onigmo regular expression support
|
||||||
|
conf.gem :github => 'mattn/mruby-onig-regexp'
|
||||||
|
end
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
# Cross Compiling configuration for the Nintendo Wii
|
||||||
|
# This configuration requires devkitPPC
|
||||||
|
# https://devkitpro.org/wiki/Getting_Started
|
||||||
|
#
|
||||||
|
#
|
||||||
|
MRuby::CrossBuild.new("wii") do |conf|
|
||||||
|
toolchain :gcc
|
||||||
|
|
||||||
|
DEVKITPRO_PATH = "/opt/devkitpro"
|
||||||
|
BIN_PATH = "#{DEVKITPRO_PATH}/devkitPPC/bin"
|
||||||
|
|
||||||
|
# C compiler
|
||||||
|
conf.cc do |cc|
|
||||||
|
cc.command = "#{BIN_PATH}/powerpc-eabi-gcc"
|
||||||
|
cc.compile_options = %(%{flags} -o "%{outfile}" -c "%{infile}")
|
||||||
|
end
|
||||||
|
|
||||||
|
# C++ compiler
|
||||||
|
conf.cxx do |cxx|
|
||||||
|
cxx.command = "#{BIN_PATH}/powerpc-eabi-g++"
|
||||||
|
cxx.include_paths = conf.cc.include_paths.dup
|
||||||
|
cxx.flags = conf.cc.flags.dup
|
||||||
|
cxx.defines = conf.cc.defines.dup
|
||||||
|
cxx.compile_options = conf.cc.compile_options.dup
|
||||||
|
end
|
||||||
|
|
||||||
|
# Linker
|
||||||
|
conf.linker do |linker|
|
||||||
|
linker.command = "#{BIN_PATH}/powerpc-eabi-gcc"
|
||||||
|
end
|
||||||
|
|
||||||
|
# No executables
|
||||||
|
conf.bins = []
|
||||||
|
|
||||||
|
# Do not build executable test
|
||||||
|
conf.build_mrbtest_lib_only
|
||||||
|
|
||||||
|
# Disable C++ exception
|
||||||
|
conf.disable_cxx_exception
|
||||||
|
|
||||||
|
# All current core gems with ones with build issues commented out
|
||||||
|
conf.gem 'mrbgems/mruby-array-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-bigint/'
|
||||||
|
conf.gem 'mrbgems/mruby-bin-config/'
|
||||||
|
conf.gem 'mrbgems/mruby-bin-debugger/'
|
||||||
|
conf.gem 'mrbgems/mruby-bin-mirb/'
|
||||||
|
conf.gem 'mrbgems/mruby-bin-mrbc/'
|
||||||
|
conf.gem 'mrbgems/mruby-bin-mruby/'
|
||||||
|
conf.gem 'mrbgems/mruby-bin-strip/'
|
||||||
|
conf.gem 'mrbgems/mruby-binding/'
|
||||||
|
conf.gem 'mrbgems/mruby-catch/'
|
||||||
|
conf.gem 'mrbgems/mruby-class-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-cmath/'
|
||||||
|
conf.gem 'mrbgems/mruby-compar-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-compiler/'
|
||||||
|
conf.gem 'mrbgems/mruby-complex/'
|
||||||
|
conf.gem 'mrbgems/mruby-data/'
|
||||||
|
#conf.gem 'mrbgems/mruby-dir/'
|
||||||
|
conf.gem 'mrbgems/mruby-enum-chain/'
|
||||||
|
conf.gem 'mrbgems/mruby-enum-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-enum-lazy/'
|
||||||
|
conf.gem 'mrbgems/mruby-enumerator/'
|
||||||
|
conf.gem 'mrbgems/mruby-errno/'
|
||||||
|
conf.gem 'mrbgems/mruby-error/'
|
||||||
|
conf.gem 'mrbgems/mruby-eval/'
|
||||||
|
conf.gem 'mrbgems/mruby-exit/'
|
||||||
|
conf.gem 'mrbgems/mruby-fiber/'
|
||||||
|
conf.gem 'mrbgems/mruby-hash-ext/'
|
||||||
|
#conf.gem 'mrbgems/mruby-io/'
|
||||||
|
conf.gem 'mrbgems/mruby-kernel-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-math/'
|
||||||
|
conf.gem 'mrbgems/mruby-metaprog/'
|
||||||
|
conf.gem 'mrbgems/mruby-method/'
|
||||||
|
conf.gem 'mrbgems/mruby-numeric-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-object-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-objectspace/'
|
||||||
|
conf.gem 'mrbgems/mruby-os-memsize/'
|
||||||
|
conf.gem 'mrbgems/mruby-pack/'
|
||||||
|
conf.gem 'mrbgems/mruby-print/'
|
||||||
|
conf.gem 'mrbgems/mruby-proc-binding/'
|
||||||
|
conf.gem 'mrbgems/mruby-proc-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-random/'
|
||||||
|
conf.gem 'mrbgems/mruby-range-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-rational/'
|
||||||
|
conf.gem 'mrbgems/mruby-set/'
|
||||||
|
conf.gem 'mrbgems/mruby-sleep/'
|
||||||
|
#conf.gem 'mrbgems/mruby-socket/'
|
||||||
|
conf.gem 'mrbgems/mruby-sprintf/'
|
||||||
|
conf.gem 'mrbgems/mruby-string-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-struct/'
|
||||||
|
conf.gem 'mrbgems/mruby-symbol-ext/'
|
||||||
|
conf.gem 'mrbgems/mruby-test-inline-struct/'
|
||||||
|
#conf.gem 'mrbgems/mruby-test/'
|
||||||
|
conf.gem 'mrbgems/mruby-time/'
|
||||||
|
conf.gem 'mrbgems/mruby-toplevel-ext/'
|
||||||
|
end
|
||||||
+3
-7
@@ -1,20 +1,16 @@
|
|||||||
ans
|
ans
|
||||||
ba
|
celler
|
||||||
clen
|
clen
|
||||||
creat
|
|
||||||
delet
|
delet
|
||||||
disabl
|
disabl
|
||||||
falsy
|
|
||||||
filetest
|
filetest
|
||||||
fo
|
fo
|
||||||
hel
|
hel
|
||||||
hist
|
|
||||||
ist
|
ist
|
||||||
methid
|
|
||||||
nd
|
nd
|
||||||
quitt
|
quitt
|
||||||
remore
|
remore
|
||||||
ro
|
|
||||||
runn
|
runn
|
||||||
sting
|
sting
|
||||||
upto
|
strin
|
||||||
|
wronly
|
||||||
|
|||||||
+56
-6
@@ -80,7 +80,7 @@ conf.toolchain :clang
|
|||||||
#### Visual Studio 2010, 2012 and 2013
|
#### Visual Studio 2010, 2012 and 2013
|
||||||
|
|
||||||
Toolchain configuration for Visual Studio on Windows. If you use the
|
Toolchain configuration for Visual Studio on Windows. If you use the
|
||||||
[Visual Studio Command Prompt](https://msdn.microsoft.com/en-us/library/ms229859\(v=vs.110\).aspx),
|
[Visual Studio Command Prompt](<https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx>),
|
||||||
you normally do not have to specify this manually, since it gets automatically detected by our build process.
|
you normally do not have to specify this manually, since it gets automatically detected by our build process.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
@@ -177,7 +177,7 @@ conf.linker do |linker|
|
|||||||
linker.flags_before_libraries = ...
|
linker.flags_before_libraries = ...
|
||||||
linker.libraries = ...
|
linker.libraries = ...
|
||||||
linker.flags_after_libraries = ...
|
linker.flags_after_libraries = ...
|
||||||
linker.library_paths = ....
|
linker.library_paths = ...
|
||||||
linker.option_library = ...
|
linker.option_library = ...
|
||||||
linker.option_library_path = ...
|
linker.option_library_path = ...
|
||||||
linker.link_options = ...
|
linker.link_options = ...
|
||||||
@@ -265,7 +265,7 @@ There is a `RubyGem` (gem for CRuby) named `mgem` that help you to
|
|||||||
manage `mrbgems`. Try `gem install mgem`. `mgem` can show you the list
|
manage `mrbgems`. Try `gem install mgem`. `mgem` can show you the list
|
||||||
of registered `mrbgems`.
|
of registered `mrbgems`.
|
||||||
|
|
||||||
See doc/mrbgems/README.md for more option about mrbgems.
|
See [doc/guides/mrbgems.md](mrbgems.md) for more option about mrbgems.
|
||||||
|
|
||||||
### Mrbtest
|
### Mrbtest
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ end
|
|||||||
|
|
||||||
## Build process
|
## Build process
|
||||||
|
|
||||||
During the build process the directory `build` will be created in the
|
During the build process the `build` directory will be created in the
|
||||||
root directory. The structure of this directory will look like this:
|
root directory. The structure of this directory will look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -460,7 +460,7 @@ compile for `i386` a directory called `i386` is created under the
|
|||||||
build directory.
|
build directory.
|
||||||
|
|
||||||
The cross compilation workflow starts in the same way as the normal
|
The cross compilation workflow starts in the same way as the normal
|
||||||
compilation by compiling all *native* libraries and binaries, except
|
compilation by compiling all _native_ libraries and binaries, except
|
||||||
for we don't have `host/mrbc` directory (`host` directory itself works
|
for we don't have `host/mrbc` directory (`host` directory itself works
|
||||||
as placeholder for `mrbc`). Afterwards the cross compilation process
|
as placeholder for `mrbc`). Afterwards the cross compilation process
|
||||||
proceeds like this:
|
proceeds like this:
|
||||||
@@ -527,7 +527,7 @@ After the build, you will get `libmruby.a`. You can link it to your application.
|
|||||||
For compiler options and library path, you can use `mruby-config` command for
|
For compiler options and library path, you can use `mruby-config` command for
|
||||||
convenience. `mruby-config` command prints the configuration used for `libmruby.a`.
|
convenience. `mruby-config` command prints the configuration used for `libmruby.a`.
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ mruby-config --help
|
$ mruby-config --help
|
||||||
Usage: mruby-config [switches]
|
Usage: mruby-config [switches]
|
||||||
switches:
|
switches:
|
||||||
@@ -557,6 +557,56 @@ LDFLAGS = `$(MRB_CONFIG) --ldflags`
|
|||||||
LIBS = `$(MRB_CONFIG) --libs`
|
LIBS = `$(MRB_CONFIG) --libs`
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To install the files in the `bin`, `include` and `lib` directories generated by the "host" build target into a system directory, do the following:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ rake install
|
||||||
|
```
|
||||||
|
|
||||||
|
If there are multiple build targets in the build configuration file, to install the products of all build targets, do the following:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ rake install:full
|
||||||
|
```
|
||||||
|
|
||||||
|
To install only one of several build targets, e.g., the "its-mine" build target, do the following:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ rake install:full:its-mine
|
||||||
|
```
|
||||||
|
|
||||||
|
To install only the executable files, do the following:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ rake install_bin # only "host" build target
|
||||||
|
$ rake install:bin # all build targets
|
||||||
|
$ rake install:bin:its-mine # only "its-mine" build target
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installation Directory
|
||||||
|
|
||||||
|
The installation directory is `/usr/local` for the "host" build target and `/usr/local/mruby/<build-name>` for the others.
|
||||||
|
To change them, you can set the environment variable `PREFIX` or use `MRuby::Build#install_prefix = dir` in your build configuration file.
|
||||||
|
|
||||||
|
The `PREFIX` environment variable affects all build targets and changes the `/usr/local` part.
|
||||||
|
|
||||||
|
The `MRuby::Build#install_prefix` can be set for each individual build target.
|
||||||
|
In this case, the environment variable `PREFIX` is ignored.
|
||||||
|
|
||||||
|
Also, if the environment variable `DESTDIR` is set, it will prepend to the path obtained by `install_prefix` to determine the final write directory.
|
||||||
|
This is intended for temporary file expansion by the user's package work.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
To summarize:
|
||||||
|
|
||||||
|
- The default value of the environment variable `PREFIX` is `/usr/local`.
|
||||||
|
- For the "host" build target, the default value of `MRuby::Build#install_prefix` is `<PREFIX>`.
|
||||||
|
- For a build target other than "host", the default value of `MRuby::Build#install_prefix` is `<PREFIX>/mruby/<build-name>`.
|
||||||
|
- If the environment variable `DESTDIR` is set, the actual write directory is `<DESTDIR>/<MRuby::Build#install_prefix>`.
|
||||||
|
|
||||||
## Tips
|
## Tips
|
||||||
|
|
||||||
- If you see compilation troubles, try `rake clean` first.
|
- If you see compilation troubles, try `rake clean` first.
|
||||||
|
|||||||
+16
-16
@@ -38,7 +38,7 @@ To confirm mrdb was installed properly, run mrdb with the `--version` option:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mrdb --version
|
$ mrdb --version
|
||||||
mruby 3.1.0 (2022-05-12)
|
mruby 3.3.0 (2024-02-14)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2.2 Basic Operation
|
## 2.2 Basic Operation
|
||||||
@@ -61,20 +61,20 @@ $ mrdb sample.rb
|
|||||||
|
|
||||||
You can execute the shell commands listed below:
|
You can execute the shell commands listed below:
|
||||||
|
|
||||||
|command|description|
|
| command | description |
|
||||||
|:-:|:--|
|
| :--------------: | :------------------------------------------------------------------------ |
|
||||||
|run|execute programs|
|
| run | execute programs |
|
||||||
|step|execute stepping|
|
| step | execute stepping |
|
||||||
|continue|execute continuing program|
|
| continue | execute continuing program |
|
||||||
|break|configure the breaking point|
|
| break | configure the breaking point |
|
||||||
|delete|deleting the breaking points|
|
| delete | deleting the breaking points |
|
||||||
|disable|disabling the breaking points|
|
| disable | disabling the breaking points |
|
||||||
|enable|enabling the breaking points|
|
| enable | enabling the breaking points |
|
||||||
|info breakpoints|showing list of the breaking points|
|
| info breakpoints | showing list of the breaking points |
|
||||||
|print|evaluating and printing the values of the mruby expressions in the script|
|
| print | evaluating and printing the values of the mruby expressions in the script |
|
||||||
|list|displaying the source cords|
|
| list | displaying the source cords |
|
||||||
|help|showing help|
|
| help | showing help |
|
||||||
|quit|terminating the mruby debugger|
|
| quit | terminating the mruby debugger |
|
||||||
|
|
||||||
### 2.2.2 Debugging mruby Binary Files (mrb file) with mrdb
|
### 2.2.2 Debugging mruby Binary Files (mrb file) with mrdb
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ You can debug the mruby binary files.
|
|||||||
#### 2.2.2.1 Debugging the binary files
|
#### 2.2.2.1 Debugging the binary files
|
||||||
|
|
||||||
- notice
|
- notice
|
||||||
To debug mruby binary files, you need to compile mruby files with option `-g`.
|
To debug mruby binary files, you need to compile mruby files with option `-g`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mrbc -g sample.rb
|
$ mrbc -g sample.rb
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
_This is an English translation of [Matz's blog post][matz blog post]
|
_This is an English translation of [Matz's blog post][matz blog post]
|
||||||
written in Japanese._
|
written in Japanese._
|
||||||
_Some parts are updated to reflect recent changes._
|
_Some parts are updated to reflect recent changes._
|
||||||
[matz blog post]: <https://www.rubyist.net/~matz/20130731.html>
|
|
||||||
|
[matz blog post]: https://www.rubyist.net/~matz/20130731.html
|
||||||
|
|
||||||
When you are extending mruby using C language, you may encounter
|
When you are extending mruby using C language, you may encounter
|
||||||
mysterious "arena overflow error" or memory leak or very slow
|
mysterious "arena overflow error" or memory leak or very slow
|
||||||
@@ -62,7 +63,7 @@ memory leak.
|
|||||||
|
|
||||||
As of this writing, mruby automatically extend arena to remember
|
As of this writing, mruby automatically extend arena to remember
|
||||||
objects (See `MRB_GC_FIXED_ARENA` and `MRB_GC_ARENA_SIZE` in
|
objects (See `MRB_GC_FIXED_ARENA` and `MRB_GC_ARENA_SIZE` in
|
||||||
doc/guides/mrbconf.md).
|
[doc/guides/mrbconf.md](mrbconf.md)).
|
||||||
|
|
||||||
If you create many objects in C functions, memory usage will increase, since
|
If you create many objects in C functions, memory usage will increase, since
|
||||||
GC never kicks in. This memory usage may look like memory leaks, but will also
|
GC never kicks in. This memory usage may look like memory leaks, but will also
|
||||||
@@ -106,7 +107,7 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
|
|||||||
char tail[] = { ']' };
|
char tail[] = { ']' };
|
||||||
|
|
||||||
/* check recursive */
|
/* check recursive */
|
||||||
for(i=0; i<RARRAY_LEN(list); i++) {
|
for (i=0; i<RARRAY_LEN(list); i++) {
|
||||||
if (mrb_obj_equal(mrb, ary, RARRAY_PTR(list)[i])) {
|
if (mrb_obj_equal(mrb, ary, RARRAY_PTR(list)[i])) {
|
||||||
return mrb_str_new(mrb, "[...]", 5);
|
return mrb_str_new(mrb, "[...]", 5);
|
||||||
}
|
}
|
||||||
@@ -117,7 +118,7 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list)
|
|||||||
arystr = mrb_str_new_capa(mrb, 64);
|
arystr = mrb_str_new_capa(mrb, 64);
|
||||||
mrb_str_cat(mrb, arystr, head, sizeof(head));
|
mrb_str_cat(mrb, arystr, head, sizeof(head));
|
||||||
|
|
||||||
for(i=0; i<RARRAY_LEN(ary); i++) {
|
for (i=0; i<RARRAY_LEN(ary); i++) {
|
||||||
int ai = mrb_gc_arena_save(mrb);
|
int ai = mrb_gc_arena_save(mrb);
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
|||||||
+8
-8
@@ -51,10 +51,10 @@ for example:
|
|||||||
To retrieve compiler options used to build `mruby`, you can use `mruby-config`
|
To retrieve compiler options used to build `mruby`, you can use `mruby-config`
|
||||||
command with following options:
|
command with following options:
|
||||||
|
|
||||||
- `--cc` compiler name
|
- `--cc` compiler name
|
||||||
- `--cflags` options passed to compiler
|
- `--cflags` options passed to compiler
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ mruby-config --cflags
|
$ mruby-config --cflags
|
||||||
-std=gnu99 -g -O3 -Wall -DMRB_GC_FIXED_ARENA -I/home/matz/work/mruby/include -I/home/matz/work/mruby/build/host/include
|
-std=gnu99 -g -O3 -Wall -DMRB_GC_FIXED_ARENA -I/home/matz/work/mruby/include -I/home/matz/work/mruby/build/host/include
|
||||||
```
|
```
|
||||||
@@ -66,12 +66,12 @@ compatible to mruby configuration.
|
|||||||
|
|
||||||
To retrieve linker options, you can use `mruby-config` with following options:
|
To retrieve linker options, you can use `mruby-config` with following options:
|
||||||
|
|
||||||
- `--ld` linker name
|
- `--ld` linker name
|
||||||
- `--ldflags` options passed to linker
|
- `--ldflags` options passed to linker
|
||||||
- `--ldflags-before-libs` options passed to linker before linked libraries
|
- `--ldflags-before-libs` options passed to linker before linked libraries
|
||||||
- `--libs` linked libraries
|
- `--libs` linked libraries
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ mruby-config --ldflags
|
$ mruby-config --ldflags
|
||||||
-L/home/matz/work/mruby/build/host/lib
|
-L/home/matz/work/mruby/build/host/lib
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Memory Allocation
|
||||||
|
|
||||||
|
There are three methods to customize memory allocation in mruby.
|
||||||
|
|
||||||
|
1. Provide your own `realloc()`/`free()`
|
||||||
|
2. Redefine `mrb_default_allocf()`
|
||||||
|
3. Specify a function with `mrb_open_allocf()`
|
||||||
|
|
||||||
|
## Provide your own `realloc()`/`free()`
|
||||||
|
|
||||||
|
On some platforms, especially on microcontrollers, the standard library may not provide `malloc()`, `realloc()`, and `free()`. In such cases, it may be necessary to define memory allocation functions for the specific platform. mruby uses `realloc()` and `free()` from the standard C library for memory management. By defining these two functions of your own, you can make mruby work. However, note the following two points:
|
||||||
|
|
||||||
|
First, `realloc(NULL, size)` behaves the same as malloc(size). Second, `free(NULL)` exits without doing anything.
|
||||||
|
|
||||||
|
## Redefine `mrb_default_allocf()`
|
||||||
|
|
||||||
|
The only function in mruby that uses the standard C library's memory allocation functions is `mrb_default_allocf()`, defined in `alloc.c`. By defining this function within your application, you can customize the memory management of your application.
|
||||||
|
|
||||||
|
## Specify a function with `mrb_open_allocf()`
|
||||||
|
|
||||||
|
If you want to perform different memory management for each `mrb_state` within your application, you can use the `mrb_open_allocf()` function to create the `mrb_state` structure. This allows you to specify a memory allocation function (which is compatible with `mrb_default_allocf`) for each `mrb_state`. Although this scheme is not recommended. It may become obsolete in the future, since I have never seen per mrb_state memory management use-case.
|
||||||
@@ -18,14 +18,14 @@ This is the same for `MRuby::CrossBuild`.
|
|||||||
# build_config.rb
|
# build_config.rb
|
||||||
|
|
||||||
MRuby::Build.new do |conf|
|
MRuby::Build.new do |conf|
|
||||||
.....
|
...
|
||||||
conf.defines << 'MRB_GC_FIXED_ARENA'
|
conf.defines << 'MRB_GC_FIXED_ARENA'
|
||||||
conf.defines << 'MRB_NO_METHOD_CACHE'
|
conf.defines << 'MRB_NO_METHOD_CACHE'
|
||||||
.....
|
...
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
***NOTE***
|
**_NOTE_**
|
||||||
|
|
||||||
- Use common definitions (`conf.defines`) instead of per-compiler definitions (e.g., `conf.cc.defines`) unless there is a special reason not to.
|
- Use common definitions (`conf.defines`) instead of per-compiler definitions (e.g., `conf.cc.defines`) unless there is a special reason not to.
|
||||||
- It is now deprecated to edit the `include/mruby/mrbconf.h` file or give it directly as a compiler flag, as was the case before.
|
- It is now deprecated to edit the `include/mruby/mrbconf.h` file or give it directly as a compiler flag, as was the case before.
|
||||||
@@ -123,7 +123,7 @@ end
|
|||||||
|
|
||||||
- Defines value is `1024`.
|
- Defines value is `1024`.
|
||||||
- Specifies number of `RBasic` per each heap page.
|
- Specifies number of `RBasic` per each heap page.
|
||||||
- To calculate the number of bytes per heap page, it is "(size of management data per heap page) + (size per object) * `MRB_HEAP_PAGE_SIZE`".
|
- To calculate the number of bytes per heap page, it is "(size of management data per heap page) + (size per object) \* `MRB_HEAP_PAGE_SIZE`".
|
||||||
In mruby 3.1.0, the "size of management data per heap page" is 6 words, also "size per object" is 6 words.
|
In mruby 3.1.0, the "size of management data per heap page" is 6 words, also "size per object" is 6 words.
|
||||||
For a 32-bit CPU, `(6 * 4) + (6 * 4) * MRB_HEAP_PAGE_SIZE` gives the bytes of size per heap page.
|
For a 32-bit CPU, `(6 * 4) + (6 * 4) * MRB_HEAP_PAGE_SIZE` gives the bytes of size per heap page.
|
||||||
Conversely, for example, to keep the size per heap page to 4 Ki bytes,
|
Conversely, for example, to keep the size per heap page to 4 Ki bytes,
|
||||||
@@ -135,7 +135,7 @@ end
|
|||||||
|
|
||||||
- Default value is `4`.
|
- Default value is `4`.
|
||||||
- If you're allocating data types that requires alignment more than default value define the
|
- If you're allocating data types that requires alignment more than default value define the
|
||||||
largest value of required alignment.
|
largest value of required alignment.
|
||||||
|
|
||||||
`POOL_PAGE_SIZE`
|
`POOL_PAGE_SIZE`
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ largest value of required alignment.
|
|||||||
|
|
||||||
- If defined enables fixed size `mrb_state` atexit stack.
|
- If defined enables fixed size `mrb_state` atexit stack.
|
||||||
- Raises `RuntimeError` when `mrb_state_atexit` call count to same `mrb_state` exceeds
|
- Raises `RuntimeError` when `mrb_state_atexit` call count to same `mrb_state` exceeds
|
||||||
`MRB_FIXED_STATE_ATEXIT_STACK_SIZE`'s value.
|
`MRB_FIXED_STATE_ATEXIT_STACK_SIZE`'s value.
|
||||||
|
|
||||||
`MRB_FIXED_STATE_ATEXIT_STACK_SIZE`
|
`MRB_FIXED_STATE_ATEXIT_STACK_SIZE`
|
||||||
|
|
||||||
@@ -247,6 +247,6 @@ largest value of required alignment.
|
|||||||
- Make it available `Symbol.all_symbols` in `mrbgems/mruby-symbol-ext`
|
- Make it available `Symbol.all_symbols` in `mrbgems/mruby-symbol-ext`
|
||||||
- Increase heap memory usage.
|
- Increase heap memory usage.
|
||||||
|
|
||||||
`MRB_NO_DIRECT_THREADING`
|
`MRB_USE_VM_SWITCH_DISPATCH`
|
||||||
|
|
||||||
- Turn off direct threading optimization in VM loop
|
- Turn on switch dispatch in VM loop
|
||||||
|
|||||||
+24
-9
@@ -1,6 +1,6 @@
|
|||||||
# mrbgems
|
# mrbgems
|
||||||
|
|
||||||
mrbgems is a library manager to integrate C and Ruby extension in an easy and
|
mrbgems is a library manager to integrate C and Ruby extensions in an easy and
|
||||||
standardised way into mruby. Conventionally, each mrbgem name is prefixed by
|
standardised way into mruby. Conventionally, each mrbgem name is prefixed by
|
||||||
`mruby-`, e.g. `mruby-time` for a gem that provides `Time` class functionality.
|
`mruby-`, e.g. `mruby-time` for a gem that provides `Time` class functionality.
|
||||||
|
|
||||||
@@ -92,6 +92,21 @@ end
|
|||||||
However, it should be used with caution, as it may deviate from the intent
|
However, it should be used with caution, as it may deviate from the intent
|
||||||
of the gem's author.
|
of the gem's author.
|
||||||
|
|
||||||
|
### Gem Testing
|
||||||
|
|
||||||
|
If you enable unit tests in your build with `enable_test`, tests will be
|
||||||
|
generated for all gems and their dependencies by default. If necessary, it is
|
||||||
|
possible to suppress tests for a specific gem like so:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
conf.gem 'mruby-noisygem' do |g|
|
||||||
|
g.skip_test = true
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
However, it is considered best practice to leave all tests enabled whenever
|
||||||
|
possible. A warning message will be generated for each gem with disabled tests.
|
||||||
|
|
||||||
## GemBox
|
## GemBox
|
||||||
|
|
||||||
There are instances when you wish to add a collection of mrbgems into mruby at
|
There are instances when you wish to add a collection of mrbgems into mruby at
|
||||||
@@ -160,9 +175,9 @@ The maximal GEM structure looks like this:
|
|||||||
+- test/ <- Test code (Ruby)
|
+- test/ <- Test code (Ruby)
|
||||||
```
|
```
|
||||||
|
|
||||||
The folder `mrblib` contains pure Ruby files to extend mruby. The folder `src`
|
The `mrblib` directory contains pure Ruby files to extend mruby. The `src` directory
|
||||||
contains C/C++ files to extend mruby. The folder `include` contains C/C++ header
|
contains C/C++ files to extend mruby. The `include` directory contains C/C++ header
|
||||||
files. The folder `test` contains C/C++ and pure Ruby files for testing purposes
|
files. The `test` directory contains C/C++ and pure Ruby files for testing purposes
|
||||||
which will be used by `mrbtest`. `mrbgem.rake` contains the specification
|
which will be used by `mrbtest`. `mrbgem.rake` contains the specification
|
||||||
to compile C and Ruby files. `README.md` is a short description of your GEM.
|
to compile C and Ruby files. `README.md` is a short description of your GEM.
|
||||||
|
|
||||||
@@ -233,7 +248,7 @@ Version requirement supports following operators:
|
|||||||
- '<=': is equal or lesser
|
- '<=': is equal or lesser
|
||||||
- '~>': is equal or greater and is lesser than the next major version
|
- '~>': is equal or greater and is lesser than the next major version
|
||||||
- example 1: '~> 2.2.2' means '>= 2.2.2' and '< 2.3.0'
|
- example 1: '~> 2.2.2' means '>= 2.2.2' and '< 2.3.0'
|
||||||
- example 2: '~> 2.2' means '>= 2.2.0' and '< 3.0.0'
|
- example 2: '~> 2.2' means '>= 2.2.0' and '< 3.0.0'
|
||||||
|
|
||||||
When more than one version requirements is passed, the dependency must satisfy all of it.
|
When more than one version requirements is passed, the dependency must satisfy all of it.
|
||||||
|
|
||||||
@@ -349,7 +364,7 @@ mrb_c_extension_example_gem_final(mrb_state* mrb) {
|
|||||||
|
|
||||||
mruby can be extended with pure Ruby. It is possible to override existing
|
mruby can be extended with pure Ruby. It is possible to override existing
|
||||||
classes or add new ones in this way. Put all Ruby files into the `mrblib`
|
classes or add new ones in this way. Put all Ruby files into the `mrblib`
|
||||||
folder.
|
directory.
|
||||||
|
|
||||||
### Pre-Conditions
|
### Pre-Conditions
|
||||||
|
|
||||||
@@ -377,11 +392,11 @@ none
|
|||||||
|
|
||||||
mruby can be extended with C and Ruby at the same time. It is possible to
|
mruby can be extended with C and Ruby at the same time. It is possible to
|
||||||
override existing classes or add new ones in this way. Put all Ruby files
|
override existing classes or add new ones in this way. Put all Ruby files
|
||||||
into the `mrblib` folder and all C files into the `src` folder.
|
into the `mrblib` directory and all C files into the `src` directory.
|
||||||
|
|
||||||
mruby codes under `mrblib` directory would be executed after gem init C
|
mruby codes under `mrblib` directory would be executed after gem init C
|
||||||
function is called. Make sure *mruby script* depends on *C code* and
|
function is called. Make sure _mruby script_ depends on _C code_ and
|
||||||
*C code* doesn't depend on *mruby script*.
|
_C code_ doesn't depend on _mruby script_.
|
||||||
|
|
||||||
### Pre-Conditions
|
### Pre-Conditions
|
||||||
|
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ To save RAM, `mruby` can use compile-time allocation of some symbols. You can
|
|||||||
use following macros to get preallocated symbols by including `mruby/presym.h`
|
use following macros to get preallocated symbols by including `mruby/presym.h`
|
||||||
header.
|
header.
|
||||||
|
|
||||||
- `MRB_SYM(xor)` //=> xor (Word characters)
|
- `MRB_SYM(xor)` //=> xor (Word characters)
|
||||||
- `MRB_SYM_B(xor)` //=> xor! (Method with Bang)
|
- `MRB_SYM_B(xor)` //=> xor! (Method with Bang)
|
||||||
- `MRB_SYM_Q(xor)` //=> xor? (Method with Question mark)
|
- `MRB_SYM_Q(xor)` //=> xor? (Method with Question mark)
|
||||||
- `MRB_SYM_E(xor)` //=> xor= (Method with Equal)
|
- `MRB_SYM_E(xor)` //=> xor= (Method with Equal)
|
||||||
- `MRB_CVSYM(xor)` //=> @@xor (Class Variable)
|
- `MRB_CVSYM(xor)` //=> @@xor (Class Variable)
|
||||||
- `MRB_IVSYM(xor)` //=> @xor (Instance Variable)
|
- `MRB_IVSYM(xor)` //=> @xor (Instance Variable)
|
||||||
- `MRB_OPSYM(xor)` //=> ^ (Operator)
|
- `MRB_OPSYM(xor)` //=> ^ (Operator)
|
||||||
|
|
||||||
For `MRB_OPSYM()`, specify the names corresponding to operators (see
|
For `MRB_OPSYM()`, specify the names corresponding to operators (see
|
||||||
`MRuby::Presym::OPERATORS` in `lib/mruby/presym.rb` for the names that
|
`MRuby::Presym::OPERATORS` in `lib/mruby/presym.rb` for the names that
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Some values (called immediate values, e.g. integers, booleans, symbols, etc.) ar
|
|||||||
The Word boxing packing bit patterns are like following:
|
The Word boxing packing bit patterns are like following:
|
||||||
|
|
||||||
| Types | Bit Pattern |
|
| Types | Bit Pattern |
|
||||||
|--------|---------------------------------------|
|
| ------ | ------------------------------------- |
|
||||||
| object | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxx000` |
|
| object | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxx000` |
|
||||||
| fixnum | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxx1` |
|
| fixnum | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxx1` |
|
||||||
| nil | `00000000 00000000 00000000 00000000` |
|
| nil | `00000000 00000000 00000000 00000000` |
|
||||||
@@ -24,17 +24,17 @@ The Word boxing packing bit patterns are like following:
|
|||||||
| undef | `00000000 00000000 00000000 00010100` |
|
| undef | `00000000 00000000 00000000 00010100` |
|
||||||
| symbol | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx10` |
|
| symbol | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx10` |
|
||||||
|
|
||||||
On 64 bit platform (unless `MRB_WORDBOX_NO_FLOAT_TRUNCATE`), float values are also packed in the `mrb_value`. In that case, we drop least significant 2 bits from mantissa.
|
On 64-bit platforms (unless `MRB_WORDBOX_NO_FLOAT_TRUNCATE`), float values are also packed in the `mrb_value`. In that case, we drop least significant 2 bits from mantissa.
|
||||||
If you need full precision for floating-point numbers, define `MRB_WORDBOX_NO_FLOAT_TRUNCATE`.
|
If you need full precision for floating-point numbers, define `MRB_WORDBOX_NO_FLOAT_TRUNCATE`.
|
||||||
|
|
||||||
## NaN Boxing
|
## NaN Boxing
|
||||||
|
|
||||||
NaN boxing packs the Ruby data in a floating-point numbers, which represent NaN (Not a Number) values. Under IEEE753 definitions every value that exponent is all set are considered as NaN. That means NaN can represent `2^51` values. NaN boxing is a teaching to pack the values in those NaN representation. In theory, 64 bits pointers are too big to fit in NaN, but practically most OS uses only 48 bits at most for pointers (except for some OS e.g. Solaris).
|
NaN boxing packs the Ruby data in a floating-point numbers, which represent NaN (Not a Number) values. Under IEEE753 definitions every value that exponent is all set are considered as NaN. That means NaN can represent `2^51` values. NaN boxing is a teaching to pack the values in those NaN representation. In theory, 64 bit pointers are too big to fit in NaN, but practically most OS use only 48 bits at most for pointers (except for some OS e.g. Solaris).
|
||||||
|
|
||||||
The NaN boxing packing bit patterns are like following:
|
The NaN boxing packing bit patterns are like following:
|
||||||
|
|
||||||
| Types | Bit Pattern |
|
| Types | Bit Pattern |
|
||||||
|--------|---------------------------------------------------------------------------|
|
| ------ | ------------------------------------------------------------------------- |
|
||||||
| float | `SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF` |
|
| float | `SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF` |
|
||||||
| +/-inf | `S1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000` |
|
| +/-inf | `S1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000` |
|
||||||
| nan | `01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000` |
|
| nan | `01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000` |
|
||||||
|
|||||||
+14
-20
@@ -64,7 +64,7 @@ p Liste.new "foobar"
|
|||||||
|
|
||||||
#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]
|
#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]
|
||||||
|
|
||||||
` [] `
|
`[]`
|
||||||
|
|
||||||
#### mruby [3.1.0 (2022-05-12)]
|
#### mruby [3.1.0 (2022-05-12)]
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ The declaration form of following visibility methods are not implemented.
|
|||||||
|
|
||||||
Especially, `module_function` method is not dummy, but no declaration form.
|
Especially, `module_function` method is not dummy, but no declaration form.
|
||||||
|
|
||||||
```
|
```ruby
|
||||||
module TestModule
|
module TestModule
|
||||||
module_function
|
module_function
|
||||||
def test_func
|
def test_func
|
||||||
@@ -170,7 +170,7 @@ alias $a $__a__
|
|||||||
|
|
||||||
#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]
|
#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]
|
||||||
|
|
||||||
` nil `
|
`nil`
|
||||||
|
|
||||||
#### mruby [3.1.0 (2022-05-12)]
|
#### mruby [3.1.0 (2022-05-12)]
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ The re-defined `+` operator does not accept any arguments.
|
|||||||
|
|
||||||
#### mruby [3.1.0 (2022-05-12)]
|
#### mruby [3.1.0 (2022-05-12)]
|
||||||
|
|
||||||
` 'ab' `
|
`'ab'`
|
||||||
Behavior of the operator wasn't changed.
|
Behavior of the operator wasn't changed.
|
||||||
|
|
||||||
## `Kernel#binding` is not supported until [3.0.0 (2021-03-05)]
|
## `Kernel#binding` is not supported until [3.0.0 (2021-03-05)]
|
||||||
@@ -205,26 +205,11 @@ Behavior of the operator wasn't changed.
|
|||||||
|
|
||||||
#### Ruby [ruby 2.5.1p57 (2018-03-29 revision 63029)]
|
#### Ruby [ruby 2.5.1p57 (2018-03-29 revision 63029)]
|
||||||
|
|
||||||
```
|
```shell
|
||||||
$ ruby -e 'puts Proc.new {}.binding'
|
$ ruby -e 'puts Proc.new {}.binding'
|
||||||
#<Binding:0x00000e9deabb9950>
|
#<Binding:0x00000e9deabb9950>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### mruby [3.0.0 (2021-03-05)]
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ./bin/mruby -e 'puts Proc.new {}.binding'
|
|
||||||
trace (most recent call last):
|
|
||||||
[0] -e:1
|
|
||||||
-e:1: undefined method 'binding' (NoMethodError)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### mruby [3.1.0 (2022-05-12)]
|
|
||||||
|
|
||||||
`binding` has been supported since 3.1.0.
|
|
||||||
|
|
||||||
See also [mrbgems/mruby-binding](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-binding) and [mrbgems/mruby-binding-core](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-binding-core).
|
|
||||||
|
|
||||||
## `nil?` redefinition in conditional expressions
|
## `nil?` redefinition in conditional expressions
|
||||||
|
|
||||||
Redefinition of `nil?` is ignored in conditional expressions.
|
Redefinition of `nil?` is ignored in conditional expressions.
|
||||||
@@ -259,3 +244,12 @@ f(1,[2,3])
|
|||||||
```
|
```
|
||||||
|
|
||||||
CRuby gives `[1,2,3,nil]`. mruby raises `NoMethodError` for `b`.
|
CRuby gives `[1,2,3,nil]`. mruby raises `NoMethodError` for `b`.
|
||||||
|
|
||||||
|
Keyword argument expansion has similar restrictions. The following example, gives `[1, 1]` for CRuby, mruby raises `NoMethodError` for `b`.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
def g(a: 1, b: a)
|
||||||
|
p [a,b]
|
||||||
|
end
|
||||||
|
g(a:1)
|
||||||
|
```
|
||||||
|
|||||||
+6
-5
@@ -42,10 +42,10 @@ We have ported some new syntax from CRuby.
|
|||||||
## Renamed for consistency
|
## Renamed for consistency
|
||||||
|
|
||||||
Some configuration macro names are changed for consistency (use `MRB_USE_XXX`
|
Some configuration macro names are changed for consistency (use `MRB_USE_XXX`
|
||||||
or `MRB_NO_XXX`).
|
or `MRB_NO_XXX`).
|
||||||
|
|
||||||
| mruby2 | mruby3 |
|
| mruby2 | mruby3 |
|
||||||
|--------------------------------|---------------------------|
|
| ------------------------------ | ------------------------- |
|
||||||
| `MRB_ENABLE_ALL_SYMBOLS` | `MRB_USE_ALL_SYMBOLS` |
|
| `MRB_ENABLE_ALL_SYMBOLS` | `MRB_USE_ALL_SYMBOLS` |
|
||||||
| `MRB_ENABLE_CXX_ABI` | `MRB_USE_CXX_ABI` |
|
| `MRB_ENABLE_CXX_ABI` | `MRB_USE_CXX_ABI` |
|
||||||
| `MRB_ENABLE_CXX_EXCEPTION` | `MRB_USE_CXX_EXCEPTION` |
|
| `MRB_ENABLE_CXX_EXCEPTION` | `MRB_USE_CXX_EXCEPTION` |
|
||||||
@@ -149,7 +149,8 @@ No more operand extension
|
|||||||
|
|
||||||
## Changed Instructions
|
## Changed Instructions
|
||||||
|
|
||||||
Jump addresses used to be specified by absolute offset from the start of `iseq`. Now they are relative offset from the address of the next instruction.
|
Jump addresses used to be specified by absolute offset from the start of `iseq`. Now they are relative offset from the
|
||||||
|
address of the next instruction.
|
||||||
|
|
||||||
## `Random` now use `xoshiro128++`.
|
## `Random` now use `xoshiro128++`.
|
||||||
|
|
||||||
@@ -159,4 +160,4 @@ For better and faster random number generation.
|
|||||||
|
|
||||||
Preallocated symbols are interned at compile-time. They can be accessed via symbols macros (e.g. `MRB_SYM()`).
|
Preallocated symbols are interned at compile-time. They can be accessed via symbols macros (e.g. `MRB_SYM()`).
|
||||||
|
|
||||||
See [Symbols](https://github.com/mruby/mruby/blob/master/doc/guides/symbol.md).
|
See [Symbols](guides/symbol.md).
|
||||||
|
|||||||
+25
-25
@@ -141,8 +141,8 @@ Method calling instructions are unified. Now `OP_SEND` and `OP_SENDB` (method ca
|
|||||||
|
|
||||||
The brief description of the instructions:
|
The brief description of the instructions:
|
||||||
|
|
||||||
|`OP_SEND` | BBB | `R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1],R[a+n+2]..nk) c=n|nk<<4` |
|
|`OP_SEND` | BBB | `R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1],R[a+n+2]..nk) c=n|nk<<4` |
|
||||||
|`OP_SENDB` | BBB | `R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1..nk],R[a+n+2..nk],&R[a+n+2*nk+2]) c=n|nk<<4` |
|
|`OP_SENDB` | BBB | `R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1..nk],R[a+n+2..nk],&R[a+n+2*nk+2]) c=n|nk<<4` |
|
||||||
|
|
||||||
Operand C specifies the number of arguments. Lower 4 bits (`n`) represents the number of ordinal arguments, and higher 4 bits (`nk`) represents the number of keyword arguments.
|
Operand C specifies the number of arguments. Lower 4 bits (`n`) represents the number of ordinal arguments, and higher 4 bits (`nk`) represents the number of keyword arguments.
|
||||||
When `n == 15`, the method takes arguments packed in an array. When `nk == 15`, the method takes keyword arguments are packed in a hash.
|
When `n == 15`, the method takes arguments packed in an array. When `nk == 15`, the method takes keyword arguments are packed in a hash.
|
||||||
@@ -225,31 +225,31 @@ For better and faster hash values.
|
|||||||
|
|
||||||
Following CVEs are fixed in this release.
|
Following CVEs are fixed in this release.
|
||||||
|
|
||||||
- [CVE-2021-4110](https://nvd.nist.gov/vuln/detail/CVE-2021-4110)
|
- [CVE-2021-4110](https://www.cve.org/CVERecord?id=CVE-2021-4110)
|
||||||
- [CVE-2021-4188](https://nvd.nist.gov/vuln/detail/CVE-2021-4188)
|
- [CVE-2021-4188](https://www.cve.org/CVERecord?id=CVE-2021-4188)
|
||||||
- [CVE-2022-0080](https://nvd.nist.gov/vuln/detail/CVE-2022-0080)
|
- [CVE-2022-0080](https://www.cve.org/CVERecord?id=CVE-2022-0080)
|
||||||
- [CVE-2022-0240](https://nvd.nist.gov/vuln/detail/CVE-2022-0240)
|
- [CVE-2022-0240](https://www.cve.org/CVERecord?id=CVE-2022-0240)
|
||||||
- [CVE-2022-0326](https://nvd.nist.gov/vuln/detail/CVE-2022-0326)
|
- [CVE-2022-0326](https://www.cve.org/CVERecord?id=CVE-2022-0326)
|
||||||
- [CVE-2022-0481](https://nvd.nist.gov/vuln/detail/CVE-2022-0481)
|
- [CVE-2022-0481](https://www.cve.org/CVERecord?id=CVE-2022-0481)
|
||||||
- [CVE-2022-0631](https://nvd.nist.gov/vuln/detail/CVE-2022-0631)
|
- [CVE-2022-0631](https://www.cve.org/CVERecord?id=CVE-2022-0631)
|
||||||
- [CVE-2022-0632](https://nvd.nist.gov/vuln/detail/CVE-2022-0632)
|
- [CVE-2022-0632](https://www.cve.org/CVERecord?id=CVE-2022-0632)
|
||||||
- [CVE-2022-0890](https://nvd.nist.gov/vuln/detail/CVE-2022-0890)
|
- [CVE-2022-0890](https://www.cve.org/CVERecord?id=CVE-2022-0890)
|
||||||
- [CVE-2022-1071](https://nvd.nist.gov/vuln/detail/CVE-2022-1071)
|
- [CVE-2022-1071](https://www.cve.org/CVERecord?id=CVE-2022-1071)
|
||||||
- [CVE-2022-1106](https://nvd.nist.gov/vuln/detail/CVE-2022-1106)
|
- [CVE-2022-1106](https://www.cve.org/CVERecord?id=CVE-2022-1106)
|
||||||
- [CVE-2022-1201](https://nvd.nist.gov/vuln/detail/CVE-2022-1201)
|
- [CVE-2022-1201](https://www.cve.org/CVERecord?id=CVE-2022-1201)
|
||||||
- [CVE-2022-1427](https://nvd.nist.gov/vuln/detail/CVE-2022-1427)
|
- [CVE-2022-1427](https://www.cve.org/CVERecord?id=CVE-2022-1427)
|
||||||
|
|
||||||
## Unaffected CVEs
|
## Unaffected CVEs
|
||||||
|
|
||||||
Following CVEs do not cause problems in this release. They are fixed in the later release.
|
Following CVEs do not cause problems in this release. They are fixed in the later release.
|
||||||
|
|
||||||
- [CVE-2022-0481](https://nvd.nist.gov/vuln/detail/CVE-2022-0481)
|
- [CVE-2022-0481](https://www.cve.org/CVERecord?id=CVE-2022-0481)
|
||||||
- [CVE-2022-0525](https://nvd.nist.gov/vuln/detail/CVE-2022-0525)
|
- [CVE-2022-0525](https://www.cve.org/CVERecord?id=CVE-2022-0525)
|
||||||
- [CVE-2022-0570](https://nvd.nist.gov/vuln/detail/CVE-2022-0570)
|
- [CVE-2022-0570](https://www.cve.org/CVERecord?id=CVE-2022-0570)
|
||||||
- [CVE-2022-0614](https://nvd.nist.gov/vuln/detail/CVE-2022-0614)
|
- [CVE-2022-0614](https://www.cve.org/CVERecord?id=CVE-2022-0614)
|
||||||
- [CVE-2022-0623](https://nvd.nist.gov/vuln/detail/CVE-2022-0623)
|
- [CVE-2022-0623](https://www.cve.org/CVERecord?id=CVE-2022-0623)
|
||||||
- [CVE-2022-0630](https://nvd.nist.gov/vuln/detail/CVE-2022-0630)
|
- [CVE-2022-0630](https://www.cve.org/CVERecord?id=CVE-2022-0630)
|
||||||
- [CVE-2022-0717](https://nvd.nist.gov/vuln/detail/CVE-2022-0817)
|
- [CVE-2022-0717](https://www.cve.org/CVERecord?id=CVE-2022-0817)
|
||||||
- [CVE-2022-1212](https://nvd.nist.gov/vuln/detail/CVE-2022-1212)
|
- [CVE-2022-1212](https://www.cve.org/CVERecord?id=CVE-2022-1212)
|
||||||
- [CVE-2022-1276](https://nvd.nist.gov/vuln/detail/CVE-2022-1276)
|
- [CVE-2022-1276](https://www.cve.org/CVERecord?id=CVE-2022-1276)
|
||||||
- [CVE-2022-1286](https://nvd.nist.gov/vuln/detail/CVE-2022-1286)
|
- [CVE-2022-1286](https://www.cve.org/CVERecord?id=CVE-2022-1286)
|
||||||
|
|||||||
+21
-22
@@ -32,9 +32,9 @@
|
|||||||
|
|
||||||
## New bundled gems
|
## New bundled gems
|
||||||
|
|
||||||
- mruby-errno from [https://github.com/iij/mruby-errno.git]
|
- mruby-errno from <https://github.com/iij/mruby-errno.git>
|
||||||
- mruby-set from [https://github.com/yui-knk/mruby-set.git]
|
- mruby-set from <https://github.com/yui-knk/mruby-set.git>
|
||||||
- mruby-dir from [https://github.com/iij/mruby-dir.git]
|
- mruby-dir from <https://github.com/iij/mruby-dir.git>
|
||||||
- mruby-data
|
- mruby-data
|
||||||
|
|
||||||
# Breaking Changes
|
# Breaking Changes
|
||||||
@@ -59,22 +59,21 @@ Intentional reliance on previous behavior may cause compatibility problems in yo
|
|||||||
|
|
||||||
Following CVEs are fixed.
|
Following CVEs are fixed.
|
||||||
|
|
||||||
- [CVE-2022-0080](https://nvd.nist.gov/vuln/detail/CVE-2022-0080)
|
- [CVE-2022-0080](https://www.cve.org/CVERecord?id=CVE-2022-0080)
|
||||||
- [CVE-2022-0240](https://nvd.nist.gov/vuln/detail/CVE-2022-0240)
|
- [CVE-2022-0240](https://www.cve.org/CVERecord?id=CVE-2022-0240)
|
||||||
- [CVE-2022-0326](https://nvd.nist.gov/vuln/detail/CVE-2022-0326)
|
- [CVE-2022-0326](https://www.cve.org/CVERecord?id=CVE-2022-0326)
|
||||||
- [CVE-2022-0631](https://nvd.nist.gov/vuln/detail/CVE-2022-0631)
|
- [CVE-2022-0481](https://www.cve.org/CVERecord?id=CVE-2022-0481)
|
||||||
- [CVE-2022-0481](https://nvd.nist.gov/vuln/detail/CVE-2022-0481)
|
- [CVE-2022-0525](https://www.cve.org/CVERecord?id=CVE-2022-0525)
|
||||||
- [CVE-2022-0525](https://nvd.nist.gov/vuln/detail/CVE-2022-0525)
|
- [CVE-2022-0570](https://www.cve.org/CVERecord?id=CVE-2022-0570)
|
||||||
- [CVE-2022-0570](https://nvd.nist.gov/vuln/detail/CVE-2022-0570)
|
- [CVE-2022-0614](https://www.cve.org/CVERecord?id=CVE-2022-0614)
|
||||||
- [CVE-2022-0614](https://nvd.nist.gov/vuln/detail/CVE-2022-0614)
|
- [CVE-2022-0623](https://www.cve.org/CVERecord?id=CVE-2022-0623)
|
||||||
- [CVE-2022-0623](https://nvd.nist.gov/vuln/detail/CVE-2022-0623)
|
- [CVE-2022-0630](https://www.cve.org/CVERecord?id=CVE-2022-0630)
|
||||||
- [CVE-2022-0630](https://nvd.nist.gov/vuln/detail/CVE-2022-0630)
|
- [CVE-2022-0631](https://www.cve.org/CVERecord?id=CVE-2022-0631)
|
||||||
- [CVE-2022-0631](https://nvd.nist.gov/vuln/detail/CVE-2022-0631)
|
- [CVE-2022-0632](https://www.cve.org/CVERecord?id=CVE-2022-0632)
|
||||||
- [CVE-2022-0632](https://nvd.nist.gov/vuln/detail/CVE-2022-0632)
|
- [CVE-2022-0717](https://www.cve.org/CVERecord?id=CVE-2022-0717)
|
||||||
- [CVE-2022-0717](https://nvd.nist.gov/vuln/detail/CVE-2022-0717)
|
- [CVE-2022-0890](https://www.cve.org/CVERecord?id=CVE-2022-0890)
|
||||||
- [CVE-2022-0890](https://nvd.nist.gov/vuln/detail/CVE-2022-0890)
|
- [CVE-2022-1106](https://www.cve.org/CVERecord?id=CVE-2022-1106)
|
||||||
- [CVE-2022-1106](https://nvd.nist.gov/vuln/detail/CVE-2022-1106)
|
- [CVE-2022-1212](https://www.cve.org/CVERecord?id=CVE-2022-1212)
|
||||||
- [CVE-2022-1212](https://nvd.nist.gov/vuln/detail/CVE-2022-1212)
|
- [CVE-2022-1276](https://www.cve.org/CVERecord?id=CVE-2022-1276)
|
||||||
- [CVE-2022-1276](https://nvd.nist.gov/vuln/detail/CVE-2022-1276)
|
- [CVE-2022-1286](https://www.cve.org/CVERecord?id=CVE-2022-1286)
|
||||||
- [CVE-2022-1286](https://nvd.nist.gov/vuln/detail/CVE-2022-1286)
|
- [CVE-2022-1934](https://www.cve.org/CVERecord?id=CVE-2022-1934)
|
||||||
- [CVE-2022-1934](https://nvd.nist.gov/vuln/detail/CVE-2022-1934)
|
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
# User visible changes in `mruby3.3` from `mruby3.2`
|
||||||
|
|
||||||
|
"**_NOTE_**:" are changes to be aware of.
|
||||||
|
|
||||||
|
# The language
|
||||||
|
|
||||||
|
- aliases work properly with `super` ([2ad3f0e](https://github.com/mruby/mruby/commit/2ad3f0e))
|
||||||
|
- `callee` method work differently with aliases in mruby ([f2dc76e](https://github.com/mruby/mruby/commit/f2dc76e))
|
||||||
|
- define `Kernel#respond_to_missing?` method ([347586e](https://github.com/mruby/mruby/commit/347586e))
|
||||||
|
- `_inspect` method (`inspect` with recursive check) is removed
|
||||||
|
([e2bbf75](https://github.com/mruby/mruby/commit/e2bbf75), [5cb0c74](https://github.com/mruby/mruby/commit/5cb0c74), [113565a](https://github.com/mruby/mruby/commit/113565a),
|
||||||
|
[0713f2a](https://github.com/mruby/mruby/commit/0713f2a), [6ae6b63](https://github.com/mruby/mruby/commit/6ae6b63), [fc9fffc](https://github.com/mruby/mruby/commit/fc9fffc))
|
||||||
|
- `__printstr__` method is removed; use `print` instead
|
||||||
|
([acecee0](https://github.com/mruby/mruby/commit/acecee0), [192e6e3](https://github.com/mruby/mruby/commit/192e6e3))
|
||||||
|
- New method `String#bytesplice` ([5274647](https://github.com/mruby/mruby/commit/5274647), [a2e2e83](https://github.com/mruby/mruby/commit/a2e2e83))
|
||||||
|
- Allow `return` in blocks to cross C boundaries ([#6125](https://github.com/mruby/mruby/pull/6125))
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
- mruby can be built using Docker now. Try `docker-compose build` for example. ([#5961](https://github.com/mruby/mruby/pull/5961))
|
||||||
|
- New Platform: DJGPP (MS-DOS) ([#6022](https://github.com/mruby/mruby/pull/6022))
|
||||||
|
- New Platform: Nintendo Wii ([#6086](https://github.com/mruby/mruby/pull/6086))
|
||||||
|
- Improved Platform: Android ([#6013](https://github.com/mruby/mruby/pull/6013))
|
||||||
|
- Improved Platform: Dreamcast ([#6130](https://github.com/mruby/mruby/pull/6130))
|
||||||
|
- Allow tests to be disabled for specific gems; warn about disabled tests ([#6012](https://github.com/mruby/mruby/pull/6012))
|
||||||
|
- Replace `MRB_NO_DIRECT_THREADING` with `MRB_USE_VM_SWITCH_DISPATCH` ([#5902](https://github.com/mruby/mruby/pull/5902))
|
||||||
|
|
||||||
|
# mruby memory API
|
||||||
|
|
||||||
|
- `mrb_default_allocf` can be overridden by the application ([34c5d96](https://github.com/mruby/mruby/commit/34c5d96))
|
||||||
|
- `mrb_open_allocf` will be deprecated ([cfee5c2](https://github.com/mruby/mruby/commit/cfee5c2))
|
||||||
|
|
||||||
|
# Changes in C API
|
||||||
|
|
||||||
|
- add new error handling API functions ([8c8bbd9](https://github.com/mruby/mruby/commit/8c8bbd9))
|
||||||
|
- Add `mrb_vm_ci_env_clear()` function with `MRB_API` ([#5945](https://github.com/mruby/mruby/pull/5945))
|
||||||
|
- a new function `mrb_check_frozen_value()` ([ccdf75c](https://github.com/mruby/mruby/commit/ccdf75c))
|
||||||
|
- avoid formatting in `mrb_bug()` ([82a48bd](https://github.com/mruby/mruby/commit/82a48bd)) <br>
|
||||||
|
**_NOTE_**: If you are using it, you must give a simple string or replace it with a call to `mrb_raise()` series.
|
||||||
|
- stop using `mrbc_` prefix for compiler context ([c5e3cbe](https://github.com/mruby/mruby/commit/c5e3cbe)) <br>
|
||||||
|
The same names are provided as before, but we recommend replacing them.
|
||||||
|
- Allow `Class#allocate` to be prohibited
|
||||||
|
([#5979](https://github.com/mruby/mruby/pull/5979), [#6122](https://github.com/mruby/mruby/pull/6122), [#6123](https://github.com/mruby/mruby/pull/6123)) <br>
|
||||||
|
To disable `#allocate`, use `MRB_UNDEF_ALLOCATOR()`.
|
||||||
|
This is also automatically applied when the subclass is created, but to explicitly allow it, use `MRB_DEFINE_ALLOCATOR()`.
|
||||||
|
|
||||||
|
# Changes in mrbgems
|
||||||
|
|
||||||
|
- **default.gembox**: Add mruby debugger mrdb (`mruby-bin-debugger`) ([#5966](https://github.com/mruby/mruby/pull/5966))
|
||||||
|
- **mruby-bin-config**: new options `--cxx`, `--cxxflags`, `--as`, `--asflags`, `--objc`, `--objcflags` ([#6054](https://github.com/mruby/mruby/pull/6054))
|
||||||
|
- **mruby-binding**: renamed from `mruby-binding-core` of mruby3.2 ([11af5db](https://github.com/mruby/mruby/commit/11af5db)) <br>
|
||||||
|
**_NOTE_**: If using `mruby-binding-core` of mruby 3.2, replace it with `mruby-binding`.
|
||||||
|
- **mruby-binding**: implemented `Binding#initialize_copy` method ([#5517](https://github.com/mruby/mruby/pull/5517))
|
||||||
|
- **mruby-binding**: `Kernel#binding` responds only to calls from Ruby ([#5981](https://github.com/mruby/mruby/pull/5981))
|
||||||
|
- **mruby-compar-ext**: Comparable#clamp to accept nil as arguments ([836bebc](https://github.com/mruby/mruby/commit/836bebc))
|
||||||
|
- **mruby-compiler**: add print name for identifier tokens ([d7b2e3a](https://github.com/mruby/mruby/commit/d7b2e3a))
|
||||||
|
- **mruby-data**: allow empty Data ([927a9df](https://github.com/mruby/mruby/commit/927a9df))
|
||||||
|
- **mruby-enumerator**: remove internal attribute methods `obj`, `args`, `kwd`, `meth`, `fib`. ([735fa24](https://github.com/mruby/mruby/commit/735fa24))
|
||||||
|
- **mruby-enumerator**: add Enumerator#size ([861f8bd](https://github.com/mruby/mruby/commit/861f8bd))
|
||||||
|
- **mruby-eval**: merged `mruby-binding` of mruby3.2 ([501b22a](https://github.com/mruby/mruby/commit/501b22a), [#5989](https://github.com/mruby/mruby/pull/5989)) <br>
|
||||||
|
**_NOTE_**: If using `mruby-binding` of mruby 3.2, replace it with `mruby-eval`.
|
||||||
|
- **mruby-fiber**: Add a new `mrb_fiber_new()` with `MRB_API` ([#6097](https://github.com/mruby/mruby/pull/6097))
|
||||||
|
- **mruby-fiber**: Allows calling `Fiber#resume` from C ([#6106](https://github.com/mruby/mruby/pull/6106))
|
||||||
|
- **mruby-fiber**: `Fiber#to_s` format changed ([#6105](https://github.com/mruby/mruby/pull/6105))
|
||||||
|
- **mruby-io**: add File#atime and File#ctime ([321cfe9](https://github.com/mruby/mruby/commit/321cfe9))
|
||||||
|
- **mruby-io**: Add "x" mode option for `IO.open` ([#6081](https://github.com/mruby/mruby/pull/6081))
|
||||||
|
- **mruby-io**: File.new should not take blocks ([53de964](https://github.com/mruby/mruby/commit/53de964))
|
||||||
|
- **mruby-method**: `Method#to_s` format changed ([f5bc82f](https://github.com/mruby/mruby/commit/f5bc82f), [02f189c](https://github.com/mruby/mruby/commit/02f189c))
|
||||||
|
- **mruby-numeric-ext**: `int.pow(n,m)` to take bigint as exponential ([d482eab](https://github.com/mruby/mruby/commit/d482eab))
|
||||||
|
- **mruby-pack**: support new directives `j`, `J`, `b`, `B`, `#`
|
||||||
|
([2a1e3a5](https://github.com/mruby/mruby/commit/2a1e3a5), [e7021f1](https://github.com/mruby/mruby/commit/e7021f1), [e17f325](https://github.com/mruby/mruby/commit/e17f325))
|
||||||
|
- **mruby-range-ext**: new method `Range#overlap?` ([384d0e2](https://github.com/mruby/mruby/commit/384d0e2))
|
||||||
|
- **mruby-string-ext**: Add `String#valid_encoding?` method ([eabe2d9](https://github.com/mruby/mruby/commit/eabe2d9))
|
||||||
|
- **mruby-struct**: allow empty Struct when a name is not given ([c212ede](https://github.com/mruby/mruby/commit/c212ede))
|
||||||
|
- **mruby-time**: should allow year before 1900 ([e5de08b](https://github.com/mruby/mruby/commit/e5de08b))
|
||||||
|
- **mruby-time**: support bigint to time_t if necessary ([7096d27](https://github.com/mruby/mruby/commit/7096d27))
|
||||||
|
- **mruby-time**: need to handle negative time_t ([b064d7e](https://github.com/mruby/mruby/commit/b064d7e))
|
||||||
|
|
||||||
|
# Changes in build system
|
||||||
|
|
||||||
|
- Extended `rake install` task ([#5928](https://github.com/mruby/mruby/pull/5928)) <br>
|
||||||
|
**_NOTE_**: Due to this impact, executable files in the `mruby/bin/` directory by default are now symbolic links (batch files on Windows).
|
||||||
|
If previously relied on those executables, should be replaced with direct references to the entity created under the build directory (e.g. `mruby/build/host/bin/`).
|
||||||
|
- Encode and decode escape characters for presym ([#6011](https://github.com/mruby/mruby/pull/6011))
|
||||||
|
- Rakefile: remove default build target directories in `deep_clean` ([#6032](https://github.com/mruby/mruby/pull/6032), [1e38569](https://github.com/mruby/mruby/commit/1e38569))
|
||||||
|
|
||||||
|
# Other breaking changes
|
||||||
|
|
||||||
|
- `mrb_f_raise()` is now an internal function
|
||||||
|
([#5923](https://github.com/mruby/mruby/pull/5923), [#6070](https://github.com/mruby/mruby/pull/6070))
|
||||||
|
- `mrb_make_exception()` is now an internal function with different parameters
|
||||||
|
([431f83e](https://github.com/mruby/mruby/commit/431f83e), [78137f3](https://github.com/mruby/mruby/commit/78137f3))
|
||||||
|
- The `File#path` method no longer uses the `#to_path` method for implicit conversion
|
||||||
|
([d86c4a7](https://github.com/mruby/mruby/commit/d86c4a7))
|
||||||
|
- stop mrb isolation for each test file ([a20fbe5](https://github.com/mruby/mruby/commit/a20fbe5))
|
||||||
|
- RBreak remembers the CI location ([#6103](https://github.com/mruby/mruby/pull/6103))
|
||||||
|
|
||||||
|
# Bugs Fixed
|
||||||
|
|
||||||
|
- [#5724](https://github.com/mruby/mruby/issues/5724) Rational#\*\* is missing
|
||||||
|
- [#5725](https://github.com/mruby/mruby/issues/5725) weird const_missing exceptions in mrblib code
|
||||||
|
- [#5789](https://github.com/mruby/mruby/issues/5789) No memory release of backtrace information due to stack error
|
||||||
|
- [#5932](https://github.com/mruby/mruby/issues/5932) How to create a block using the C API? mrb_yield keeps crashing!
|
||||||
|
- [#5943](https://github.com/mruby/mruby/issues/5943) TCPSocket#write is failed
|
||||||
|
- [#5944](https://github.com/mruby/mruby/issues/5944) Behavior of calling method with a hash variable
|
||||||
|
- [#5946](https://github.com/mruby/mruby/pull/5946) Don't switch constant search path from modules to Object
|
||||||
|
- [#5949](https://github.com/mruby/mruby/issues/5949) Caller appears to report wrong line when block passed and brackets omitted
|
||||||
|
- [0906cd7](https://github.com/mruby/mruby/commit/0906cd7) numeric.c: fix rounding function issues with big numbers
|
||||||
|
- [#5974](https://github.com/mruby/mruby/issues/5974) Invalid escape sequences in gem_init.c on windows
|
||||||
|
- [#5975](https://github.com/mruby/mruby/issues/5975) Equals comparison fails on extreme ends of 64-bit integers
|
||||||
|
- [#5985](https://github.com/mruby/mruby/issues/5985) Sign extension with OP_LOADI32 in get_int_operand()
|
||||||
|
- [#5986](https://github.com/mruby/mruby/issues/5986) Fix bugs in String#bytesplice
|
||||||
|
- [#5987](https://github.com/mruby/mruby/issues/5987) ~(-1 << 64) is incorrect
|
||||||
|
- [#5991](https://github.com/mruby/mruby/issues/5991) 'gets' method not working in mruby-3.2.0
|
||||||
|
- [#5994](https://github.com/mruby/mruby/pull/5994) fix typo in mrbgems/mruby-io/src/io.c
|
||||||
|
- [#5995](https://github.com/mruby/mruby/issues/5995) One seemingly unnecessary parameter is passed in the block parameters
|
||||||
|
- [#6008](https://github.com/mruby/mruby/pull/6008) Make "bintest" independent of directory
|
||||||
|
- [b47c8b7](https://github.com/mruby/mruby/commit/b47c8b7) gc.c (clear_all_old): fix a generational GC bug
|
||||||
|
- [#6029](https://github.com/mruby/mruby/issues/6029) mruby build fails under mrbgems directory
|
||||||
|
- [a264965](https://github.com/mruby/mruby/commit/a264965) mruby-os-memsize/memsize.c: fix irep size calculation
|
||||||
|
- [3310e10](https://github.com/mruby/mruby/commit/3310e10) mruby-test/mrbgem.rake: fix mrb_state handling bug
|
||||||
|
- [#6041](https://github.com/mruby/mruby/issues/6041) GC Performance may have degraded
|
||||||
|
- [#6044](https://github.com/mruby/mruby/issues/6044) Generated presym/table.h contains invalid characters
|
||||||
|
- [#6051](https://github.com/mruby/mruby/issues/6051) Null pointer dereference in mrb_addrinfo_unix_path
|
||||||
|
- [#6052](https://github.com/mruby/mruby/issues/6052) Null pointer dereference while handling the Proc class
|
||||||
|
- [#6055](https://github.com/mruby/mruby/pull/6055) Fix libmruby name for VisualC++
|
||||||
|
- [#6060](https://github.com/mruby/mruby/issues/6060) SEGFAULT Issue Related to Fiber Usage in ngx_mruby Development
|
||||||
|
- [#6061](https://github.com/mruby/mruby/issues/6061) Performance issue in String#codepoints
|
||||||
|
- [#6064](https://github.com/mruby/mruby/issues/6064) MRUBY_PACKAGE_DIR does not always have a value.
|
||||||
|
- [#6065](https://github.com/mruby/mruby/issues/6065) Null pointer dereference while handling the Proc class
|
||||||
|
- [#6066](https://github.com/mruby/mruby/issues/6066) Null pointer dereference involving Struct.new()
|
||||||
|
- [#6067](https://github.com/mruby/mruby/issues/6067) Null pointer dereference in mrb_string_value_cstr
|
||||||
|
- [#6068](https://github.com/mruby/mruby/issues/6068) Stack overflow in mrb_vm_exec
|
||||||
|
- [#6076](https://github.com/mruby/mruby/pull/6076) Fixed unwinding block that could point to invalid PC
|
||||||
|
- [#6084](https://github.com/mruby/mruby/issues/6084) Incorrect symbolic sinks in binary built on Linux
|
||||||
|
- [#6087](https://github.com/mruby/mruby/issues/6087) 'Remote branch HEAD not found in upstream origin' error on build
|
||||||
|
- [#6089](https://github.com/mruby/mruby/issues/6089) binding.eval() handles def expressions differently from CRuby
|
||||||
|
- [#6098](https://github.com/mruby/mruby/issues/6098) Fails to call superclass of wrapped method
|
||||||
|
- [#6099](https://github.com/mruby/mruby/issues/6099) `ensure` section is not executed if the function exits via a return in a proc
|
||||||
|
- [#6108](https://github.com/mruby/mruby/issues/6108) VM crashes with break
|
||||||
|
- [#6118](https://github.com/mruby/mruby/pull/6118) Fixed IO#read with buf
|
||||||
|
- [#6120](https://github.com/mruby/mruby/pull/6120) Set EBADF if check_file_descriptor() fails
|
||||||
|
- [#6126](https://github.com/mruby/mruby/pull/6126) Fixed return value of `OP_RETURN_BLK` called directly under C function
|
||||||
|
- [#6134](https://github.com/mruby/mruby/issues/6134) String#unpack1 returns an array instead of a single string
|
||||||
|
- [#6136](https://github.com/mruby/mruby/pull/6136) Fixed when combined `mrb_fiber_resume()` and `Fiber#transfer`
|
||||||
|
|
||||||
|
# Pull Requests (User Visible Ones)
|
||||||
|
|
||||||
|
- [#5517](https://github.com/mruby/mruby/pull/5517) Fixed local variables not separated between copied binding objects
|
||||||
|
- [#5902](https://github.com/mruby/mruby/pull/5902) Replace `MRB_NO_DIRECT_THREADING` with `MRB_USE_VM_SWITCH_DISPATCH`
|
||||||
|
- [#5923](https://github.com/mruby/mruby/pull/5923) Demotion `mrb_f_raise()` from `MRB_API`
|
||||||
|
- [#5928](https://github.com/mruby/mruby/pull/5928) Improved `rake install`
|
||||||
|
- [#5945](https://github.com/mruby/mruby/pull/5945) Avoid exposure for `REnv` objects
|
||||||
|
- [#5946](https://github.com/mruby/mruby/pull/5946) Don't switch constant search path from modules to Object
|
||||||
|
- [#5966](https://github.com/mruby/mruby/pull/5966) Update default.gembox add mruby debugger mrdb
|
||||||
|
- [#5979](https://github.com/mruby/mruby/pull/5979) Allow Class#allocate to be prohibited
|
||||||
|
- [#5981](https://github.com/mruby/mruby/pull/5981) `Kernel#binding` responds only to calls from Ruby
|
||||||
|
- [#5989](https://github.com/mruby/mruby/pull/5989) Integrate mruby-binding-eval into mruby-eval
|
||||||
|
- [#5961](https://github.com/mruby/mruby/pull/5961) Add Docker to build and run all mruby tests. Run pre-commit and generate YARD docs with Docker
|
||||||
|
- [#5994](https://github.com/mruby/mruby/pull/5994) fix typo in mrbgems/mruby-io/src/io.c
|
||||||
|
- [#6008](https://github.com/mruby/mruby/pull/6008) Make "bintest" independent of directory
|
||||||
|
- [#6009](https://github.com/mruby/mruby/pull/6009) Avoid adding <MRUBY_ROOT>/bintest which does not exist
|
||||||
|
- [#6011](https://github.com/mruby/mruby/pull/6011) Encode and decode escape characters for presym
|
||||||
|
- [#6012](https://github.com/mruby/mruby/pull/6012) Allow tests to be disabled for specific gems; warn about disabled tests
|
||||||
|
- [#6013](https://github.com/mruby/mruby/pull/6013) Fix Android toolchain
|
||||||
|
- [#6022](https://github.com/mruby/mruby/pull/6022) Build configuration for MS-DOS and DJGPP
|
||||||
|
- [#6032](https://github.com/mruby/mruby/pull/6032) Rake: update task clean to remove bin and build folders
|
||||||
|
- [#6045](https://github.com/mruby/mruby/pull/6045) Fixes escape sequence bug and enhancements in Presym scanning
|
||||||
|
- [#6054](https://github.com/mruby/mruby/pull/6054) Extends `bin/mruby-config`
|
||||||
|
- [#6055](https://github.com/mruby/mruby/pull/6055) Fix libmruby name for VisualC++
|
||||||
|
- [#6070](https://github.com/mruby/mruby/pull/6070) Demotion mrb_f_raise() in kernel.c from MRB_API too
|
||||||
|
- [#6076](https://github.com/mruby/mruby/pull/6076) Fixed unwinding block that could point to invalid PC
|
||||||
|
- [#6081](https://github.com/mruby/mruby/pull/6081) Add "x" mode option for IO.open
|
||||||
|
- [#6086](https://github.com/mruby/mruby/pull/6086) Add build config for Nintendo Wii
|
||||||
|
- [#6097](https://github.com/mruby/mruby/pull/6097) Add a new mrb_fiber_new() with MRB_API
|
||||||
|
- [#6103](https://github.com/mruby/mruby/pull/6103) RBreak remembers the CI location
|
||||||
|
- [#6105](https://github.com/mruby/mruby/pull/6105) Implement `Fiber#to_s` method
|
||||||
|
- [#6106](https://github.com/mruby/mruby/pull/6106) Ease fiber limitations
|
||||||
|
- [#6118](https://github.com/mruby/mruby/pull/6118) Fixed IO#read with buf
|
||||||
|
- [#6120](https://github.com/mruby/mruby/pull/6120) Set EBADF if check_file_descriptor() fails
|
||||||
|
- [#6122](https://github.com/mruby/mruby/pull/6122) Prohibit `Class#allocate` in a different way
|
||||||
|
- [#6123](https://github.com/mruby/mruby/pull/6123) Inherit `MRB_FL_UNDEF_ALLOCATE` in subclasses
|
||||||
|
- [#6125](https://github.com/mruby/mruby/pull/6125) Allow `OP_RETURN_BLK` to cross C boundaries
|
||||||
|
- [#6126](https://github.com/mruby/mruby/pull/6126) Fixed return value of `OP_RETURN_BLK` called directly under C function
|
||||||
|
- [#6130](https://github.com/mruby/mruby/pull/6130) `dreamcast_shelf build config`: complete overhaul
|
||||||
|
- [#6136](https://github.com/mruby/mruby/pull/6136) Fixed when combined `mrb_fiber_resume()` and `Fiber#transfer`
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
command: sh -c 'rake deep_clean && rake -m test:build && rake test:run'
|
||||||
|
environment:
|
||||||
|
- MRUBY_CONFIG=ci/gcc-clang
|
||||||
|
- CC=gcc
|
||||||
|
- CXX=g++
|
||||||
|
- LD=gcc
|
||||||
|
- SKIP=check-executables-have-shebangs
|
||||||
|
working_dir: /app
|
||||||
@@ -35,7 +35,7 @@ mrb_foo_get_bar(mrb_state *mrb, mrb_value self)
|
|||||||
struct Foo *f;
|
struct Foo *f;
|
||||||
|
|
||||||
f = (struct Foo*)mrb_data_get_ptr(mrb, self, &mrb_foo_type);
|
f = (struct Foo*)mrb_data_get_ptr(mrb, self, &mrb_foo_type);
|
||||||
if(f == NULL) {
|
if (f == NULL) {
|
||||||
mrb_raise(mrb, E_RUNTIME_ERROR, "uninitialized data");
|
mrb_raise(mrb, E_RUNTIME_ERROR, "uninitialized data");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ mrb_foo_set_bar(mrb_state *mrb, mrb_value self)
|
|||||||
int v;
|
int v;
|
||||||
|
|
||||||
f = (struct Foo*)mrb_data_get_ptr(mrb, self, &mrb_foo_type);
|
f = (struct Foo*)mrb_data_get_ptr(mrb, self, &mrb_foo_type);
|
||||||
if(f == NULL) {
|
if (f == NULL) {
|
||||||
mrb_raise(mrb, E_RUNTIME_ERROR, "uninitialized data");
|
mrb_raise(mrb, E_RUNTIME_ERROR, "uninitialized data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ The file structure in this example is as follows:
|
|||||||
+- mruby-YOUR-bigint/ <- Make this directory public if necessary.
|
+- mruby-YOUR-bigint/ <- Make this directory public if necessary.
|
||||||
| Change the name of copied directory.
|
| Change the name of copied directory.
|
||||||
|
|
|
|
||||||
+- TODO-HINT.md <- This file is currently viewing by you.
|
+- TODO-HINT.md <- You are currently viewing this file.
|
||||||
| Remove this from copied directory.
|
| Remove this from copied directory.
|
||||||
|
|
|
|
||||||
+- core/
|
+- core/
|
||||||
@@ -21,19 +21,19 @@ The file structure in this example is as follows:
|
|||||||
May be depended on by other GEMs.
|
May be depended on by other GEMs.
|
||||||
```
|
```
|
||||||
|
|
||||||
Implementors of own bigints should copy below this directory to another directory and do the following:
|
Implementers of their own bigints should copy below this directory to another directory and do the following:
|
||||||
|
|
||||||
- Rewrite `spec.author`, `spec.license`, `spec.homepage` and `spec.summary` in `<gem-dir>/mrbgem.rake` file to those of your own implementors.
|
- Rewrite `spec.author`, `spec.license`, `spec.homepage` and `spec.summary` in `<gem-dir>/mrbgem.rake` file to those of your own implementers.
|
||||||
- Implement the respective functions in `<gem-dir>/core/bigint.c`.
|
- Implement the respective functions in `<gem-dir>/core/bigint.c`.
|
||||||
- Define and use an object structure for `MRB_TT_BIGINT` type-tag.
|
- Define and use an object structure for `MRB_TT_BIGINT` type-tag.
|
||||||
It is recommended to use `mrb_static_assert_object_size()` to ensure that the size of the object structure is within 6 words.
|
It is recommended to use `mrb_static_assert_object_size()` to ensure that the size of the object structure is within six words.
|
||||||
- Delete this file from the destination of the copy.
|
- Delete this file from the destination of the copy.
|
||||||
|
|
||||||
If you wish to use it as an alternative to the `mruby-bigint` provided by mruby, please leave the GEM name in `<gem-dir>/mrbgem.rake` as it is.
|
If you wish to use it as an alternative to the `mruby-bigint` provided by mruby, please leave the GEM name in `<gem-dir>/mrbgem.rake` as it is.
|
||||||
This is an important factor when it is depended from other GEMs with `spec.add_dependency 'mruby-bigint'`.
|
This is an important factor when it is depended from other GEMs with `spec.add_dependency 'mruby-bigint'`.
|
||||||
|
|
||||||
The name of the top directory of GEM can be changed arbitrarily.
|
The name of the top directory of the GEM can be changed arbitrarily.
|
||||||
The name of the git repository can also be changed arbitrarily.
|
The name of the Git repository can also be changed arbitrarily.
|
||||||
|
|
||||||
Note that there is no need for an initialization function as there is in normal GEM.
|
Note that there is no need for an initialization function as there is in a normal GEM.
|
||||||
If you need it, create a file `<gem-dir>/src/bigint.c` for example, and implement the `mrb_mruby_bigint_gem_init()` function.
|
If you need it, create a file `<gem-dir>/src/bigint.c` for example, and implement the `mrb_mruby_bigint_gem_init()` function.
|
||||||
|
|||||||
+2
-2
@@ -176,8 +176,8 @@
|
|||||||
#if defined(DISABLE_STDIO) || defined(MRB_DISABLE_STDIO)
|
#if defined(DISABLE_STDIO) || defined(MRB_DISABLE_STDIO)
|
||||||
# define MRB_NO_STDIO
|
# define MRB_NO_STDIO
|
||||||
#endif
|
#endif
|
||||||
#ifdef MRB_DISABLE_DIRECT_THREADING
|
#if defined(MRB_DISABLE_DIRECT_THREADING) || defined(MRB_NO_DIRECT_THREADING)
|
||||||
# define MRB_NO_DIRECT_THREADING
|
# define MRB_USE_VM_SWITCH_DISPATCH
|
||||||
#endif
|
#endif
|
||||||
#if defined(ENABLE_DEBUG) || defined(MRB_ENABLE_DEBUG_HOOK)
|
#if defined(ENABLE_DEBUG) || defined(MRB_ENABLE_DEBUG_HOOK)
|
||||||
# define MRB_USE_DEBUG_HOOK
|
# define MRB_USE_DEBUG_HOOK
|
||||||
|
|||||||
+26
-32
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
** mruby - An embeddable Ruby implementation
|
** mruby - An embeddable Ruby implementation
|
||||||
**
|
**
|
||||||
** Copyright (c) mruby developers 2010-2023
|
** Copyright (c) mruby developers 2010-
|
||||||
**
|
**
|
||||||
** Permission is hereby granted, free of charge, to any person obtaining
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
** a copy of this software and associated documentation files (the
|
** a copy of this software and associated documentation files (the
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MRuby C API entry point
|
* mruby C API entry point
|
||||||
*/
|
*/
|
||||||
MRB_BEGIN_DECL
|
MRB_BEGIN_DECL
|
||||||
|
|
||||||
@@ -162,11 +162,11 @@ struct mrb_state;
|
|||||||
*
|
*
|
||||||
* The function pointing it must behave similarly as realloc except:
|
* The function pointing it must behave similarly as realloc except:
|
||||||
* - If ptr is NULL it must allocate new space.
|
* - If ptr is NULL it must allocate new space.
|
||||||
* - If s is NULL, ptr must be freed.
|
* - If size is zero, ptr must be freed.
|
||||||
*
|
*
|
||||||
* See @see mrb_default_allocf for the default implementation.
|
* See @see mrb_default_allocf for the default implementation.
|
||||||
*/
|
*/
|
||||||
typedef void* (*mrb_allocf) (struct mrb_state *mrb, void*, size_t, void *ud);
|
typedef void* (*mrb_allocf) (struct mrb_state *mrb, void *ptr, size_t size, void *ud);
|
||||||
|
|
||||||
#ifndef MRB_FIXED_STATE_ATEXIT_STACK_SIZE
|
#ifndef MRB_FIXED_STATE_ATEXIT_STACK_SIZE
|
||||||
#define MRB_FIXED_STATE_ATEXIT_STACK_SIZE 5
|
#define MRB_FIXED_STATE_ATEXIT_STACK_SIZE 5
|
||||||
@@ -420,7 +420,7 @@ MRB_API void mrb_prepend_module(mrb_state *mrb, struct RClass *cla, struct RClas
|
|||||||
* mrb_define_method(mrb, mrb->kernel_module, "example_method", example_method, MRB_ARGS_NONE());
|
* mrb_define_method(mrb, mrb->kernel_module, "example_method", example_method, MRB_ARGS_NONE());
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @param mrb The MRuby state reference.
|
* @param mrb The mruby state reference.
|
||||||
* @param cla The class pointer where the method will be defined.
|
* @param cla The class pointer where the method will be defined.
|
||||||
* @param name The name of the method being defined.
|
* @param name The name of the method being defined.
|
||||||
* @param func The function pointer to the method definition.
|
* @param func The function pointer to the method definition.
|
||||||
@@ -448,7 +448,7 @@ MRB_API void mrb_define_method_id(mrb_state *mrb, struct RClass *c, mrb_sym mid,
|
|||||||
* foo = mrb_define_class(mrb, "Foo", mrb->object_class);
|
* foo = mrb_define_class(mrb, "Foo", mrb->object_class);
|
||||||
* mrb_define_class_method(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
|
* mrb_define_class_method(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
|
||||||
* }
|
* }
|
||||||
* @param mrb The MRuby state reference.
|
* @param mrb The mruby state reference.
|
||||||
* @param cla The class where the class method will be defined.
|
* @param cla The class where the class method will be defined.
|
||||||
* @param name The name of the class method being defined.
|
* @param name The name of the class method being defined.
|
||||||
* @param fun The function pointer to the class method definition.
|
* @param fun The function pointer to the class method definition.
|
||||||
@@ -484,7 +484,7 @@ MRB_API void mrb_define_singleton_method_id(mrb_state *mrb, struct RObject *cla,
|
|||||||
* foo = mrb_define_module(mrb, "Foo");
|
* foo = mrb_define_module(mrb, "Foo");
|
||||||
* mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
|
* mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
|
||||||
* }
|
* }
|
||||||
* @param mrb The MRuby state reference.
|
* @param mrb The mruby state reference.
|
||||||
* @param cla The module where the module function will be defined.
|
* @param cla The module where the module function will be defined.
|
||||||
* @param name The name of the module function being defined.
|
* @param name The name of the module function being defined.
|
||||||
* @param fun The function pointer to the module function definition.
|
* @param fun The function pointer to the module function definition.
|
||||||
@@ -514,7 +514,7 @@ MRB_API void mrb_define_module_function_id(mrb_state *mrb, struct RClass *cla, m
|
|||||||
* mrb_value
|
* mrb_value
|
||||||
* mrb_example_gem_final(mrb_state* mrb){
|
* mrb_example_gem_final(mrb_state* mrb){
|
||||||
* }
|
* }
|
||||||
* @param mrb The MRuby state reference.
|
* @param mrb The mruby state reference.
|
||||||
* @param cla A class or module the constant is defined in.
|
* @param cla A class or module the constant is defined in.
|
||||||
* @param name The name of the constant being defined.
|
* @param name The name of the constant being defined.
|
||||||
* @param val The value for the constant.
|
* @param val The value for the constant.
|
||||||
@@ -1017,7 +1017,7 @@ struct mrb_kwargs
|
|||||||
/**
|
/**
|
||||||
* Retrieve arguments from mrb_state.
|
* Retrieve arguments from mrb_state.
|
||||||
*
|
*
|
||||||
* @param mrb The current MRuby state.
|
* @param mrb The current mruby state.
|
||||||
* @param format is a list of format specifiers
|
* @param format is a list of format specifiers
|
||||||
* @param ... The passing variadic arguments must be a pointer of retrieving type.
|
* @param ... The passing variadic arguments must be a pointer of retrieving type.
|
||||||
* @return the number of arguments retrieved.
|
* @return the number of arguments retrieved.
|
||||||
@@ -1248,7 +1248,7 @@ MRB_API mrb_state* mrb_open(void);
|
|||||||
MRB_API mrb_state* mrb_open_allocf(mrb_allocf f, void *ud);
|
MRB_API mrb_state* mrb_open_allocf(mrb_allocf f, void *ud);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new mrb_state with just the MRuby core
|
* Create new mrb_state with just the mruby core
|
||||||
*
|
*
|
||||||
* @param f
|
* @param f
|
||||||
* Reference to the allocation function.
|
* Reference to the allocation function.
|
||||||
@@ -1303,26 +1303,17 @@ MRB_API mrb_bool mrb_eql(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
|||||||
/* mrb_cmp(mrb, obj1, obj2): 1:0:-1; -2 for error */
|
/* mrb_cmp(mrb, obj1, obj2): 1:0:-1; -2 for error */
|
||||||
MRB_API mrb_int mrb_cmp(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
MRB_API mrb_int mrb_cmp(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
|
||||||
|
|
||||||
MRB_INLINE int
|
#define mrb_gc_arena_save(mrb) ((mrb)->gc.arena_idx)
|
||||||
mrb_gc_arena_save(mrb_state *mrb)
|
#define mrb_gc_arena_restore(mrb, idx) ((mrb)->gc.arena_idx = (idx))
|
||||||
{
|
|
||||||
return mrb->gc.arena_idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
MRB_INLINE void
|
|
||||||
mrb_gc_arena_restore(mrb_state *mrb, int idx)
|
|
||||||
{
|
|
||||||
mrb->gc.arena_idx = idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
MRB_API void mrb_garbage_collect(mrb_state*);
|
MRB_API void mrb_garbage_collect(mrb_state*);
|
||||||
MRB_API void mrb_full_gc(mrb_state*);
|
MRB_API void mrb_full_gc(mrb_state*);
|
||||||
MRB_API void mrb_incremental_gc(mrb_state *);
|
MRB_API void mrb_incremental_gc(mrb_state*);
|
||||||
MRB_API void mrb_gc_mark(mrb_state*,struct RBasic*);
|
MRB_API void mrb_gc_mark(mrb_state*,struct RBasic*);
|
||||||
#define mrb_gc_mark_value(mrb,val) do {\
|
#define mrb_gc_mark_value(mrb,val) do {\
|
||||||
if (!mrb_immediate_p(val)) mrb_gc_mark((mrb), mrb_basic_ptr(val)); \
|
if (!mrb_immediate_p(val)) mrb_gc_mark((mrb), mrb_basic_ptr(val)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
MRB_API void mrb_field_write_barrier(mrb_state *, struct RBasic*, struct RBasic*);
|
MRB_API void mrb_field_write_barrier(mrb_state*, struct RBasic*, struct RBasic*);
|
||||||
#define mrb_field_write_barrier_value(mrb, obj, val) do{\
|
#define mrb_field_write_barrier_value(mrb, obj, val) do{\
|
||||||
if (!mrb_immediate_p(val)) mrb_field_write_barrier((mrb), (obj), mrb_basic_ptr(val)); \
|
if (!mrb_immediate_p(val)) mrb_field_write_barrier((mrb), (obj), mrb_basic_ptr(val)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -1366,7 +1357,7 @@ MRB_API mrb_noreturn void mrb_name_error(mrb_state *mrb, mrb_sym id, const char
|
|||||||
MRB_API mrb_noreturn void mrb_frozen_error(mrb_state *mrb, void *frozen_obj);
|
MRB_API mrb_noreturn void mrb_frozen_error(mrb_state *mrb, void *frozen_obj);
|
||||||
MRB_API mrb_noreturn void mrb_argnum_error(mrb_state *mrb, mrb_int argc, int min, int max);
|
MRB_API mrb_noreturn void mrb_argnum_error(mrb_state *mrb, mrb_int argc, int min, int max);
|
||||||
MRB_API void mrb_warn(mrb_state *mrb, const char *fmt, ...);
|
MRB_API void mrb_warn(mrb_state *mrb, const char *fmt, ...);
|
||||||
MRB_API mrb_noreturn void mrb_bug(mrb_state *mrb, const char *fmt, ...);
|
MRB_API mrb_noreturn void mrb_bug(mrb_state *mrb, const char *mesg);
|
||||||
MRB_API void mrb_print_backtrace(mrb_state *mrb);
|
MRB_API void mrb_print_backtrace(mrb_state *mrb);
|
||||||
MRB_API void mrb_print_error(mrb_state *mrb);
|
MRB_API void mrb_print_error(mrb_state *mrb);
|
||||||
/* function for `raisef` formatting */
|
/* function for `raisef` formatting */
|
||||||
@@ -1378,6 +1369,8 @@ MRB_API mrb_value mrb_vformat(mrb_state *mrb, const char *format, va_list ap);
|
|||||||
+ exception objects obtained from those macros are local to mrb
|
+ exception objects obtained from those macros are local to mrb
|
||||||
*/
|
*/
|
||||||
#define MRB_ERROR_SYM(sym) mrb_intern_lit(mrb, #sym)
|
#define MRB_ERROR_SYM(sym) mrb_intern_lit(mrb, #sym)
|
||||||
|
#define E_EXCEPTION mrb->eException_class
|
||||||
|
#define E_STANDARD_ERROR mrb->eStandardError_class
|
||||||
#define E_RUNTIME_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(RuntimeError))
|
#define E_RUNTIME_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(RuntimeError))
|
||||||
#define E_TYPE_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(TypeError))
|
#define E_TYPE_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(TypeError))
|
||||||
#define E_ZERODIV_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(ZeroDivisionError))
|
#define E_ZERODIV_ERROR mrb_exc_get_id(mrb, MRB_ERROR_SYM(ZeroDivisionError))
|
||||||
@@ -1436,12 +1429,8 @@ MRB_API mrb_value mrb_ensure_int_type(mrb_state *mrb, mrb_value val);
|
|||||||
|
|
||||||
/* string type checking (contrary to the name, it doesn't convert) */
|
/* string type checking (contrary to the name, it doesn't convert) */
|
||||||
MRB_API void mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t);
|
MRB_API void mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t);
|
||||||
|
MRB_API void mrb_check_frozen(mrb_state *mrb, void *);
|
||||||
MRB_INLINE void mrb_check_frozen(mrb_state *mrb, void *o)
|
MRB_API void mrb_check_frozen_value(mrb_state *mrb, mrb_value v);
|
||||||
{
|
|
||||||
if (mrb_frozen_p((struct RBasic*)o)) mrb_frozen_error(mrb, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
MRB_API void mrb_define_alias(mrb_state *mrb, struct RClass *c, const char *a, const char *b);
|
MRB_API void mrb_define_alias(mrb_state *mrb, struct RClass *c, const char *a, const char *b);
|
||||||
MRB_API void mrb_define_alias_id(mrb_state *mrb, struct RClass *c, mrb_sym a, mrb_sym b);
|
MRB_API void mrb_define_alias_id(mrb_state *mrb, struct RClass *c, mrb_sym a, mrb_sym b);
|
||||||
MRB_API const char *mrb_class_name(mrb_state *mrb, struct RClass* klass);
|
MRB_API const char *mrb_class_name(mrb_state *mrb, struct RClass* klass);
|
||||||
@@ -1456,14 +1445,19 @@ MRB_API mrb_bool mrb_func_basic_p(mrb_state *mrb, mrb_value obj, mrb_sym mid, mr
|
|||||||
/* obsolete function(s); will be removed */
|
/* obsolete function(s); will be removed */
|
||||||
#define mrb_int(mrb, val) mrb_as_int(mrb, val)
|
#define mrb_int(mrb, val) mrb_as_int(mrb, val)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Fiber from proc object
|
||||||
|
*
|
||||||
|
* Implemented in mruby-fiber
|
||||||
|
*/
|
||||||
|
MRB_API mrb_value mrb_fiber_new(mrb_state *mrb, const struct RProc *proc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resume a Fiber
|
* Resume a Fiber
|
||||||
*
|
*
|
||||||
* Implemented in mruby-fiber
|
* Implemented in mruby-fiber
|
||||||
*
|
*
|
||||||
* Switches to the specified fiber and executes. Like the `Fiber#resume` method.
|
* Switches to the specified fiber and executes. Like the `Fiber#resume` method.
|
||||||
*
|
|
||||||
* @note It can only be called before entering the mruby VM (e.g. in the `main()` function).
|
|
||||||
*/
|
*/
|
||||||
MRB_API mrb_value mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int argc, const mrb_value *argv);
|
MRB_API mrb_value mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int argc, const mrb_value *argv);
|
||||||
|
|
||||||
|
|||||||
+17
-10
@@ -26,6 +26,10 @@ struct RClass {
|
|||||||
MRB_INLINE struct RClass*
|
MRB_INLINE struct RClass*
|
||||||
mrb_class(mrb_state *mrb, mrb_value v)
|
mrb_class(mrb_state *mrb, mrb_value v)
|
||||||
{
|
{
|
||||||
|
if (!mrb_immediate_p(v)) {
|
||||||
|
return mrb_obj_ptr(v)->c;
|
||||||
|
}
|
||||||
|
|
||||||
switch (mrb_type(v)) {
|
switch (mrb_type(v)) {
|
||||||
case MRB_TT_FALSE:
|
case MRB_TT_FALSE:
|
||||||
if (mrb_fixnum(v))
|
if (mrb_fixnum(v))
|
||||||
@@ -43,20 +47,19 @@ mrb_class(mrb_state *mrb, mrb_value v)
|
|||||||
#endif
|
#endif
|
||||||
case MRB_TT_CPTR:
|
case MRB_TT_CPTR:
|
||||||
return mrb->object_class;
|
return mrb->object_class;
|
||||||
case MRB_TT_ENV:
|
|
||||||
return NULL;
|
|
||||||
default:
|
default:
|
||||||
return mrb_obj_ptr(v)->c;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flags:
|
/* flags:
|
||||||
20: frozen
|
20: frozen
|
||||||
19: is_prepended
|
19: is_prepended
|
||||||
18: is_origin
|
18: is_origin
|
||||||
17: is_inherited (used by method cache)
|
17: is_inherited (used by method cache)
|
||||||
16: unused
|
7-16: unused
|
||||||
0-15: instance type
|
6: prohibit Class#allocate
|
||||||
|
0-5: instance type
|
||||||
*/
|
*/
|
||||||
#define MRB_FL_CLASS_IS_PREPENDED (1 << 19)
|
#define MRB_FL_CLASS_IS_PREPENDED (1 << 19)
|
||||||
#define MRB_FL_CLASS_IS_ORIGIN (1 << 18)
|
#define MRB_FL_CLASS_IS_ORIGIN (1 << 18)
|
||||||
@@ -69,9 +72,13 @@ mrb_class(mrb_state *mrb, mrb_value v)
|
|||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
#define MRB_FL_CLASS_IS_INHERITED (1 << 17)
|
#define MRB_FL_CLASS_IS_INHERITED (1 << 17)
|
||||||
#define MRB_INSTANCE_TT_MASK (0xFF)
|
#define MRB_INSTANCE_TT_MASK (0x1F)
|
||||||
#define MRB_SET_INSTANCE_TT(c, tt) ((c)->flags = (((c)->flags & ~MRB_INSTANCE_TT_MASK) | (char)(tt)))
|
#define MRB_SET_INSTANCE_TT(c, tt) ((c)->flags = (((c)->flags & ~MRB_INSTANCE_TT_MASK) | (char)(tt)))
|
||||||
#define MRB_INSTANCE_TT(c) (enum mrb_vtype)((c)->flags & MRB_INSTANCE_TT_MASK)
|
#define MRB_INSTANCE_TT(c) (enum mrb_vtype)((c)->flags & MRB_INSTANCE_TT_MASK)
|
||||||
|
#define MRB_FL_UNDEF_ALLOCATE (1 << 6)
|
||||||
|
#define MRB_UNDEF_ALLOCATOR(c) (mrb_assert((c)->tt == MRB_TT_CLASS), (c)->flags |= MRB_FL_UNDEF_ALLOCATE)
|
||||||
|
#define MRB_UNDEF_ALLOCATOR_P(c) ((c)->flags & MRB_FL_UNDEF_ALLOCATE)
|
||||||
|
#define MRB_DEFINE_ALLOCATOR(c) ((c)->flags &= ~MRB_FL_UNDEF_ALLOCATE)
|
||||||
|
|
||||||
MRB_API void mrb_define_method_raw(mrb_state*, struct RClass*, mrb_sym, mrb_method_t);
|
MRB_API void mrb_define_method_raw(mrb_state*, struct RClass*, mrb_sym, mrb_method_t);
|
||||||
MRB_API void mrb_alias_method(mrb_state*, struct RClass *c, mrb_sym a, mrb_sym b);
|
MRB_API void mrb_alias_method(mrb_state*, struct RClass *c, mrb_sym a, mrb_sym b);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ MRB_BEGIN_DECL
|
|||||||
#endif
|
#endif
|
||||||
#define MRB_INLINE static inline
|
#define MRB_INLINE static inline
|
||||||
|
|
||||||
/** Declare a public MRuby API function. */
|
/** Declare a public mruby API function. */
|
||||||
#ifndef MRB_API
|
#ifndef MRB_API
|
||||||
#if defined(MRB_BUILD_AS_DLL)
|
#if defined(MRB_BUILD_AS_DLL)
|
||||||
#if defined(MRB_CORE) || defined(MRB_LIB)
|
#if defined(MRB_CORE) || defined(MRB_LIB)
|
||||||
|
|||||||
+26
-18
@@ -10,7 +10,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MRuby Compiler
|
* mruby Compiler
|
||||||
*/
|
*/
|
||||||
MRB_BEGIN_DECL
|
MRB_BEGIN_DECL
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ MRB_BEGIN_DECL
|
|||||||
|
|
||||||
struct mrb_parser_state;
|
struct mrb_parser_state;
|
||||||
/* load context */
|
/* load context */
|
||||||
typedef struct mrbc_context {
|
typedef struct mrb_ccontext {
|
||||||
mrb_sym *syms;
|
mrb_sym *syms;
|
||||||
int slen;
|
int slen;
|
||||||
char *filename;
|
char *filename;
|
||||||
@@ -35,13 +35,21 @@ typedef struct mrbc_context {
|
|||||||
const struct RProc *upper;
|
const struct RProc *upper;
|
||||||
|
|
||||||
size_t parser_nerr;
|
size_t parser_nerr;
|
||||||
} mrbc_context;
|
} mrb_ccontext; /* compiler context */
|
||||||
|
|
||||||
MRB_API mrbc_context* mrbc_context_new(mrb_state *mrb);
|
MRB_API mrb_ccontext* mrb_ccontext_new(mrb_state *mrb);
|
||||||
MRB_API void mrbc_context_free(mrb_state *mrb, mrbc_context *cxt);
|
MRB_API void mrb_ccontext_free(mrb_state *mrb, mrb_ccontext *cxt);
|
||||||
MRB_API const char *mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s);
|
MRB_API const char *mrb_ccontext_filename(mrb_state *mrb, mrb_ccontext *c, const char *s);
|
||||||
MRB_API void mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*partial_hook)(struct mrb_parser_state*), void*data);
|
MRB_API void mrb_ccontext_partial_hook(mrb_state *mrb, mrb_ccontext *c, int (*partial_hook)(struct mrb_parser_state*), void*data);
|
||||||
MRB_API void mrbc_cleanup_local_variables(mrb_state *mrb, mrbc_context *c);
|
MRB_API void mrb_ccontext_cleanup_local_variables(mrb_state *mrb, mrb_ccontext *c);
|
||||||
|
|
||||||
|
/* compatibility macros */
|
||||||
|
#define mrbc_context mrb_ccontext
|
||||||
|
#define mrbc_context_new mrb_ccontext_new
|
||||||
|
#define mrbc_context_free mrb_ccontext_free
|
||||||
|
#define mrbc_filename mrb_ccontext_filename
|
||||||
|
#define mrbc_partial_hook mrb_ccontext_partial_hook
|
||||||
|
#define mrbc_cleanup_local_variables mrb_ccontext_cleanup_local_variables
|
||||||
|
|
||||||
/* AST node structure */
|
/* AST node structure */
|
||||||
typedef struct mrb_ast_node {
|
typedef struct mrb_ast_node {
|
||||||
@@ -121,7 +129,7 @@ struct mrb_parser_state {
|
|||||||
/* If both f and s are non-null, it will be taken preferentially from s until s < send. */
|
/* If both f and s are non-null, it will be taken preferentially from s until s < send. */
|
||||||
FILE *f;
|
FILE *f;
|
||||||
#endif
|
#endif
|
||||||
mrbc_context *cxt;
|
mrb_ccontext *cxt;
|
||||||
mrb_sym filename_sym;
|
mrb_sym filename_sym;
|
||||||
uint16_t lineno;
|
uint16_t lineno;
|
||||||
int column;
|
int column;
|
||||||
@@ -168,19 +176,19 @@ struct mrb_parser_state {
|
|||||||
|
|
||||||
MRB_API struct mrb_parser_state* mrb_parser_new(mrb_state*);
|
MRB_API struct mrb_parser_state* mrb_parser_new(mrb_state*);
|
||||||
MRB_API void mrb_parser_free(struct mrb_parser_state*);
|
MRB_API void mrb_parser_free(struct mrb_parser_state*);
|
||||||
MRB_API void mrb_parser_parse(struct mrb_parser_state*,mrbc_context*);
|
MRB_API void mrb_parser_parse(struct mrb_parser_state*,mrb_ccontext*);
|
||||||
|
|
||||||
MRB_API void mrb_parser_set_filename(struct mrb_parser_state*, char const*);
|
MRB_API void mrb_parser_set_filename(struct mrb_parser_state*, char const*);
|
||||||
MRB_API mrb_sym mrb_parser_get_filename(struct mrb_parser_state*, uint16_t idx);
|
MRB_API mrb_sym mrb_parser_get_filename(struct mrb_parser_state*, uint16_t idx);
|
||||||
|
|
||||||
/* utility functions */
|
/* utility functions */
|
||||||
#ifndef MRB_NO_STDIO
|
#ifndef MRB_NO_STDIO
|
||||||
MRB_API struct mrb_parser_state* mrb_parse_file(mrb_state*,FILE*,mrbc_context*);
|
MRB_API struct mrb_parser_state* mrb_parse_file(mrb_state*,FILE*,mrb_ccontext*);
|
||||||
#endif
|
#endif
|
||||||
MRB_API struct mrb_parser_state* mrb_parse_string(mrb_state*,const char*,mrbc_context*);
|
MRB_API struct mrb_parser_state* mrb_parse_string(mrb_state*,const char*,mrb_ccontext*);
|
||||||
MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,size_t,mrbc_context*);
|
MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,size_t,mrb_ccontext*);
|
||||||
MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*);
|
MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*);
|
||||||
MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c);
|
MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrb_ccontext *c);
|
||||||
|
|
||||||
/** program load functions
|
/** program load functions
|
||||||
* Please note! Currently due to interactions with the GC calling these functions will
|
* Please note! Currently due to interactions with the GC calling these functions will
|
||||||
@@ -193,13 +201,13 @@ MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc
|
|||||||
*/
|
*/
|
||||||
#ifndef MRB_NO_STDIO
|
#ifndef MRB_NO_STDIO
|
||||||
MRB_API mrb_value mrb_load_file(mrb_state*,FILE*);
|
MRB_API mrb_value mrb_load_file(mrb_state*,FILE*);
|
||||||
MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrbc_context *cxt);
|
MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrb_ccontext *cxt);
|
||||||
MRB_API mrb_value mrb_load_detect_file_cxt(mrb_state *mrb, FILE *fp, mrbc_context *c);
|
MRB_API mrb_value mrb_load_detect_file_cxt(mrb_state *mrb, FILE *fp, mrb_ccontext *c);
|
||||||
#endif
|
#endif
|
||||||
MRB_API mrb_value mrb_load_string(mrb_state *mrb, const char *s);
|
MRB_API mrb_value mrb_load_string(mrb_state *mrb, const char *s);
|
||||||
MRB_API mrb_value mrb_load_nstring(mrb_state *mrb, const char *s, size_t len);
|
MRB_API mrb_value mrb_load_nstring(mrb_state *mrb, const char *s, size_t len);
|
||||||
MRB_API mrb_value mrb_load_string_cxt(mrb_state *mrb, const char *s, mrbc_context *cxt);
|
MRB_API mrb_value mrb_load_string_cxt(mrb_state *mrb, const char *s, mrb_ccontext *cxt);
|
||||||
MRB_API mrb_value mrb_load_nstring_cxt(mrb_state *mrb, const char *s, size_t len, mrbc_context *cxt);
|
MRB_API mrb_value mrb_load_nstring_cxt(mrb_state *mrb, const char *s, size_t len, mrb_ccontext *cxt);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
MRB_END_DECL
|
MRB_END_DECL
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ MRB_API struct RData *mrb_data_object_alloc(mrb_state *mrb, struct RClass* klass
|
|||||||
|
|
||||||
#define Data_Make_Struct(mrb,klass,strct,type,sval,data_obj) do { \
|
#define Data_Make_Struct(mrb,klass,strct,type,sval,data_obj) do { \
|
||||||
(data_obj) = Data_Wrap_Struct(mrb,klass,type,NULL);\
|
(data_obj) = Data_Wrap_Struct(mrb,klass,type,NULL);\
|
||||||
(sval) = (strct *)mrb_malloc(mrb, sizeof(strct)); \
|
(sval) = (strct*)mrb_malloc(mrb, sizeof(strct)); \
|
||||||
{ static const strct zero = { 0 }; *(sval) = zero; };\
|
{ static const strct zero = { 0 }; *(sval) = zero; };\
|
||||||
(data_obj)->data = (sval);\
|
(data_obj)->data = (sval);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RDATA(obj) ((struct RData *)(mrb_ptr(obj)))
|
#define RDATA(obj) ((struct RData*)(mrb_ptr(obj)))
|
||||||
#define DATA_PTR(d) (RDATA(d)->data)
|
#define DATA_PTR(d) (RDATA(d)->data)
|
||||||
#define DATA_TYPE(d) (RDATA(d)->type)
|
#define DATA_TYPE(d) (RDATA(d)->type)
|
||||||
MRB_API void mrb_data_check_type(mrb_state *mrb, mrb_value, const mrb_data_type*);
|
MRB_API void mrb_data_check_type(mrb_state *mrb, mrb_value, const mrb_data_type*);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MRuby Debugging.
|
* mruby Debugging.
|
||||||
*/
|
*/
|
||||||
MRB_BEGIN_DECL
|
MRB_BEGIN_DECL
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ typedef struct mrb_irep_debug_info {
|
|||||||
} mrb_irep_debug_info;
|
} mrb_irep_debug_info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get line from irep's debug info and program counter
|
* get filename from irep's debug info and program counter
|
||||||
* @return returns NULL if not found
|
* @return returns NULL if not found
|
||||||
*/
|
*/
|
||||||
MRB_API const char *mrb_debug_get_filename(mrb_state *mrb, const mrb_irep *irep, uint32_t pc);
|
MRB_API const char *mrb_debug_get_filename(mrb_state *mrb, const mrb_irep *irep, uint32_t pc);
|
||||||
@@ -57,6 +57,12 @@ MRB_API const char *mrb_debug_get_filename(mrb_state *mrb, const mrb_irep *irep,
|
|||||||
*/
|
*/
|
||||||
MRB_API int32_t mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc);
|
MRB_API int32_t mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get line and filename from irep's debug info and program counter
|
||||||
|
* @return returns FALSE if not found
|
||||||
|
*/
|
||||||
|
MRB_API mrb_bool mrb_debug_get_position(mrb_state *mrb, const mrb_irep *irep, uint32_t pc, int32_t *lp, const char **fp);
|
||||||
|
|
||||||
MRB_API mrb_irep_debug_info *mrb_debug_info_alloc(mrb_state *mrb, mrb_irep *irep);
|
MRB_API mrb_irep_debug_info *mrb_debug_info_alloc(mrb_state *mrb, mrb_irep *irep);
|
||||||
MRB_API mrb_irep_debug_info_file *mrb_debug_info_append_file(
|
MRB_API mrb_irep_debug_info_file *mrb_debug_info_append_file(
|
||||||
mrb_state *mrb, mrb_irep_debug_info *info,
|
mrb_state *mrb, mrb_irep_debug_info *info,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ MRB_BEGIN_DECL
|
|||||||
|
|
||||||
#ifndef MRB_NO_STDIO
|
#ifndef MRB_NO_STDIO
|
||||||
MRB_API mrb_value mrb_load_irep_file(mrb_state*,FILE*);
|
MRB_API mrb_value mrb_load_irep_file(mrb_state*,FILE*);
|
||||||
MRB_API mrb_value mrb_load_irep_file_cxt(mrb_state*, FILE*, mrbc_context*);
|
MRB_API mrb_value mrb_load_irep_file_cxt(mrb_state*, FILE*, mrb_ccontext*);
|
||||||
mrb_irep *mrb_read_irep_file(mrb_state*, FILE*);
|
mrb_irep *mrb_read_irep_file(mrb_state*, FILE*);
|
||||||
int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*);
|
int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static inline int
|
|||||||
check_little_endian(void)
|
check_little_endian(void)
|
||||||
{
|
{
|
||||||
unsigned int n = 1;
|
unsigned int n = 1;
|
||||||
return (*(unsigned char *)&n == 1);
|
return (*(unsigned char*)&n == 1);
|
||||||
}
|
}
|
||||||
# define littleendian check_little_endian()
|
# define littleendian check_little_endian()
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+28
-14
@@ -10,7 +10,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MRuby error handling.
|
* mruby error handling.
|
||||||
*/
|
*/
|
||||||
MRB_BEGIN_DECL
|
MRB_BEGIN_DECL
|
||||||
|
|
||||||
@@ -34,26 +34,33 @@ struct RException {
|
|||||||
MRB_API mrb_noreturn void mrb_sys_fail(mrb_state *mrb, const char *mesg);
|
MRB_API mrb_noreturn void mrb_sys_fail(mrb_state *mrb, const char *mesg);
|
||||||
MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str);
|
MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str);
|
||||||
#define mrb_exc_new_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
|
#define mrb_exc_new_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
|
||||||
MRB_API mrb_value mrb_make_exception(mrb_state *mrb, mrb_int argc, const mrb_value *argv);
|
|
||||||
MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...);
|
MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...);
|
||||||
|
|
||||||
/* declaration for `fail` method */
|
|
||||||
MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value);
|
|
||||||
|
|
||||||
#if defined(MRB_64BIT) || defined(MRB_USE_FLOAT32) || defined(MRB_NAN_BOXING) || defined(MRB_WORD_BOXING)
|
#if defined(MRB_64BIT) || defined(MRB_USE_FLOAT32) || defined(MRB_NAN_BOXING) || defined(MRB_WORD_BOXING)
|
||||||
|
#undef MRB_USE_RBREAK_VALUE_UNION
|
||||||
|
#else
|
||||||
|
#define MRB_USE_RBREAK_VALUE_UNION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* flags:
|
||||||
|
* 0..7: enum mrb_vtype (only when defined MRB_USE_RBREAK_VALUE_UNION)
|
||||||
|
* 8..10: RBREAK_TAGs in src/vm.c (otherwise, set to 0)
|
||||||
|
*/
|
||||||
struct RBreak {
|
struct RBreak {
|
||||||
MRB_OBJECT_HEADER;
|
MRB_OBJECT_HEADER;
|
||||||
const struct RProc *proc;
|
uintptr_t ci_break_index; // The top-level ci index to break. One before the return destination.
|
||||||
|
#ifndef MRB_USE_RBREAK_VALUE_UNION
|
||||||
mrb_value val;
|
mrb_value val;
|
||||||
|
#else
|
||||||
|
union mrb_value_union value;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef MRB_USE_RBREAK_VALUE_UNION
|
||||||
#define mrb_break_value_get(brk) ((brk)->val)
|
#define mrb_break_value_get(brk) ((brk)->val)
|
||||||
#define mrb_break_value_set(brk, v) ((brk)->val = v)
|
#define mrb_break_value_set(brk, v) ((brk)->val = v)
|
||||||
#else
|
#else
|
||||||
struct RBreak {
|
|
||||||
MRB_OBJECT_HEADER;
|
|
||||||
const struct RProc *proc;
|
|
||||||
union mrb_value_union value;
|
|
||||||
};
|
|
||||||
#define RBREAK_VALUE_TT_MASK ((1 << 8) - 1)
|
#define RBREAK_VALUE_TT_MASK ((1 << 8) - 1)
|
||||||
static inline mrb_value
|
static inline mrb_value
|
||||||
mrb_break_value_get(struct RBreak *brk)
|
mrb_break_value_get(struct RBreak *brk)
|
||||||
@@ -70,9 +77,16 @@ mrb_break_value_set(struct RBreak *brk, mrb_value val)
|
|||||||
brk->flags &= ~RBREAK_VALUE_TT_MASK;
|
brk->flags &= ~RBREAK_VALUE_TT_MASK;
|
||||||
brk->flags |= val.tt;
|
brk->flags |= val.tt;
|
||||||
}
|
}
|
||||||
#endif /* MRB_64BIT || MRB_USE_FLOAT32 || MRB_NAN_BOXING || MRB_WORD_BOXING */
|
#endif /* MRB_USE_RBREAK_VALUE_UNION */
|
||||||
#define mrb_break_proc_get(brk) ((brk)->proc)
|
|
||||||
#define mrb_break_proc_set(brk, p) ((brk)->proc = p)
|
/**
|
||||||
|
* Error check
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* clear error status in the mrb_state structure */
|
||||||
|
MRB_API void mrb_clear_error(mrb_state *mrb);
|
||||||
|
/* returns TRUE if error in the previous call; internally calls mrb_clear_error() */
|
||||||
|
MRB_API mrb_bool mrb_check_error(mrb_state *mrb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protect
|
* Protect
|
||||||
|
|||||||
+20
-31
@@ -41,48 +41,37 @@ typedef enum {
|
|||||||
#pragma warning(disable : 4200)
|
#pragma warning(disable : 4200)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct mrb_heap_page {
|
|
||||||
struct RBasic *freelist;
|
|
||||||
struct mrb_heap_page *prev;
|
|
||||||
struct mrb_heap_page *next;
|
|
||||||
struct mrb_heap_page *free_next;
|
|
||||||
struct mrb_heap_page *free_prev;
|
|
||||||
mrb_bool old:1;
|
|
||||||
/* Flexible array members area a C99 feature, not C++ compatible */
|
|
||||||
/* void* objects[]; */
|
|
||||||
} mrb_heap_page;
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct mrb_gc {
|
typedef struct mrb_gc {
|
||||||
mrb_heap_page *heaps; /* heaps for GC */
|
struct mrb_heap_page *heaps; /* all heaps pages */
|
||||||
mrb_heap_page *sweeps;
|
struct mrb_heap_page *free_heaps;/* heaps for allocation */
|
||||||
mrb_heap_page *free_heaps;
|
struct mrb_heap_page *sweeps; /* page where sweep starts */
|
||||||
size_t live; /* count of live objects */
|
struct RBasic *gray_list; /* list of gray objects to be traversed incrementally */
|
||||||
|
struct RBasic *atomic_gray_list; /* list of objects to be traversed atomically */
|
||||||
|
size_t live; /* count of live objects */
|
||||||
|
size_t live_after_mark; /* old generation objects */
|
||||||
|
size_t threshold; /* threshold to start GC */
|
||||||
|
size_t oldgen_threshold; /* threshold to kick major GC */
|
||||||
|
mrb_gc_state state; /* current state of gc */
|
||||||
|
int interval_ratio;
|
||||||
|
int step_ratio;
|
||||||
|
int current_white_part :2; /* make white object by white_part */
|
||||||
|
mrb_bool iterating :1; /* currently iterating over objects */
|
||||||
|
mrb_bool disabled :1; /* GC disabled */
|
||||||
|
mrb_bool generational :1; /* generational GC mode */
|
||||||
|
mrb_bool full :1; /* major GC mode */
|
||||||
|
mrb_bool out_of_memory :1; /* out-of-memory error occurred */
|
||||||
|
|
||||||
#ifdef MRB_GC_FIXED_ARENA
|
#ifdef MRB_GC_FIXED_ARENA
|
||||||
struct RBasic *arena[MRB_GC_ARENA_SIZE]; /* GC protection array */
|
struct RBasic *arena[MRB_GC_ARENA_SIZE]; /* GC protection array */
|
||||||
#else
|
#else
|
||||||
struct RBasic **arena; /* GC protection array */
|
struct RBasic **arena; /* GC protection array */
|
||||||
int arena_capa;
|
int arena_capa; /* size of protection array */
|
||||||
#endif
|
#endif
|
||||||
int arena_idx;
|
int arena_idx;
|
||||||
|
|
||||||
mrb_gc_state state; /* state of gc */
|
|
||||||
int current_white_part; /* make white object by white_part */
|
|
||||||
struct RBasic *gray_list; /* list of gray objects to be traversed incrementally */
|
|
||||||
struct RBasic *atomic_gray_list; /* list of objects to be traversed atomically */
|
|
||||||
size_t live_after_mark;
|
|
||||||
size_t threshold;
|
|
||||||
int interval_ratio;
|
|
||||||
int step_ratio;
|
|
||||||
mrb_bool iterating :1;
|
|
||||||
mrb_bool disabled :1;
|
|
||||||
mrb_bool full :1;
|
|
||||||
mrb_bool generational :1;
|
|
||||||
mrb_bool out_of_memory :1;
|
|
||||||
size_t majorgc_old_threshold;
|
|
||||||
} mrb_gc;
|
} mrb_gc;
|
||||||
|
|
||||||
MRB_API mrb_bool mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
|
MRB_API mrb_bool mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ void mrb_ary_decref(mrb_state*, mrb_shared_array*);
|
|||||||
mrb_value mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len);
|
mrb_value mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mrb_bool mrb_inspect_recursive_p(mrb_state *mrb, mrb_value self);
|
||||||
|
|
||||||
#ifdef MRUBY_CLASS_H
|
#ifdef MRUBY_CLASS_H
|
||||||
struct RClass *mrb_vm_define_class(mrb_state*, mrb_value, mrb_value, mrb_sym);
|
struct RClass *mrb_vm_define_class(mrb_state*, mrb_value, mrb_value, mrb_sym);
|
||||||
struct RClass *mrb_vm_define_module(mrb_state*, mrb_value, mrb_sym);
|
struct RClass *mrb_vm_define_module(mrb_state*, mrb_value, mrb_sym);
|
||||||
@@ -23,11 +25,16 @@ mrb_value mrb_mod_to_s(mrb_state *, mrb_value);
|
|||||||
void mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid);
|
void mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid);
|
||||||
mrb_noreturn void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args);
|
mrb_noreturn void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args);
|
||||||
mrb_method_t mrb_vm_find_method(mrb_state *mrb, struct RClass *c, struct RClass **cp, mrb_sym mid);
|
mrb_method_t mrb_vm_find_method(mrb_state *mrb, struct RClass *c, struct RClass **cp, mrb_sym mid);
|
||||||
|
mrb_value mrb_mod_const_missing(mrb_state *mrb, mrb_value mod);
|
||||||
|
mrb_value mrb_const_missing(mrb_state *mrb, mrb_value mod, mrb_sym sym);
|
||||||
|
size_t mrb_class_mt_memsize(mrb_state*, struct RClass*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mrb_value mrb_obj_equal_m(mrb_state *mrb, mrb_value);
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
size_t mrb_packed_int_len(uint32_t num);
|
size_t mrb_packed_int_len(uint32_t num);
|
||||||
size_t mrb_packed_int_encode(uint32_t num, uint8_t *p, uint8_t *pend);
|
size_t mrb_packed_int_encode(uint32_t num, uint8_t *p);
|
||||||
uint32_t mrb_packed_int_decode(const uint8_t *p, const uint8_t **newpos);
|
uint32_t mrb_packed_int_decode(const uint8_t *p, const uint8_t **newpos);
|
||||||
|
|
||||||
/* dump */
|
/* dump */
|
||||||
@@ -51,6 +58,8 @@ mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
|
|||||||
mrb_value mrb_get_backtrace(mrb_state *mrb);
|
mrb_value mrb_get_backtrace(mrb_state *mrb);
|
||||||
void mrb_exc_mesg_set(mrb_state *mrb, struct RException *exc, mrb_value mesg);
|
void mrb_exc_mesg_set(mrb_state *mrb, struct RException *exc, mrb_value mesg);
|
||||||
mrb_value mrb_exc_mesg_get(mrb_state *mrb, struct RException *exc);
|
mrb_value mrb_exc_mesg_get(mrb_state *mrb, struct RException *exc);
|
||||||
|
mrb_value mrb_f_raise(mrb_state*, mrb_value);
|
||||||
|
mrb_value mrb_make_exception(mrb_state *mrb, mrb_value exc, mrb_value mesg);
|
||||||
|
|
||||||
/* gc */
|
/* gc */
|
||||||
void mrb_gc_mark_mt(mrb_state*, struct RClass*);
|
void mrb_gc_mark_mt(mrb_state*, struct RClass*);
|
||||||
@@ -89,6 +98,9 @@ mrb_value mrb_int_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
|||||||
mrb_value mrb_int_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_int_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_noreturn void mrb_int_zerodiv(mrb_state *mrb);
|
mrb_noreturn void mrb_int_zerodiv(mrb_state *mrb);
|
||||||
mrb_noreturn void mrb_int_overflow(mrb_state *mrb, const char *reason);
|
mrb_noreturn void mrb_int_overflow(mrb_state *mrb, const char *reason);
|
||||||
|
#ifndef MRB_NO_FLOAT
|
||||||
|
void mrb_check_num_exact(mrb_state *mrb, mrb_float num);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MRB_USE_COMPLEX
|
#ifdef MRB_USE_COMPLEX
|
||||||
mrb_value mrb_complex_new(mrb_state *mrb, mrb_float x, mrb_float y);
|
mrb_value mrb_complex_new(mrb_state *mrb, mrb_float x, mrb_float y);
|
||||||
@@ -112,6 +124,11 @@ struct RProc *mrb_closure_new(mrb_state*, const mrb_irep*);
|
|||||||
void mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b);
|
void mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b);
|
||||||
mrb_int mrb_proc_arity(const struct RProc *p);
|
mrb_int mrb_proc_arity(const struct RProc *p);
|
||||||
struct REnv *mrb_env_new(mrb_state *mrb, struct mrb_context *c, mrb_callinfo *ci, int nstacks, mrb_value *stack, struct RClass *tc);
|
struct REnv *mrb_env_new(mrb_state *mrb, struct mrb_context *c, mrb_callinfo *ci, int nstacks, mrb_value *stack, struct RClass *tc);
|
||||||
|
void mrb_proc_merge_lvar(mrb_state *mrb, mrb_irep *irep, struct REnv *env, int num, const mrb_sym *lv, const mrb_value *stack);
|
||||||
|
mrb_value mrb_proc_local_variables(mrb_state *mrb, const struct RProc *proc);
|
||||||
|
const struct RProc *mrb_proc_get_caller(mrb_state *mrb, struct REnv **env);
|
||||||
|
mrb_value mrb_proc_get_self(mrb_state *mrb, struct RProc *p, struct RClass **target_class_p);
|
||||||
|
mrb_bool mrb_proc_eql(mrb_state *mrb, mrb_value self, mrb_value other);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* range */
|
/* range */
|
||||||
@@ -171,21 +188,28 @@ mrb_value mrb_f_send(mrb_state *mrb, mrb_value self);
|
|||||||
|
|
||||||
#ifdef MRB_USE_BIGINT
|
#ifdef MRB_USE_BIGINT
|
||||||
mrb_value mrb_bint_new_int(mrb_state *mrb, mrb_int x);
|
mrb_value mrb_bint_new_int(mrb_state *mrb, mrb_int x);
|
||||||
|
#ifdef MRB_INT64
|
||||||
|
#define mrb_bint_new_int64(mrb,x) mrb_bint_new_int((mrb),(mrb_int)(x))
|
||||||
|
#else
|
||||||
|
mrb_value mrb_bint_new_int64(mrb_state *mrb, int64_t x);
|
||||||
|
#endif
|
||||||
|
mrb_value mrb_bint_new_uint64(mrb_state *mrb, uint64_t x);
|
||||||
mrb_value mrb_bint_new_str(mrb_state *mrb, const char *x, mrb_int len, mrb_int base);
|
mrb_value mrb_bint_new_str(mrb_state *mrb, const char *x, mrb_int len, mrb_int base);
|
||||||
mrb_value mrb_as_bint(mrb_state *mrb, mrb_value x);
|
mrb_value mrb_as_bint(mrb_state *mrb, mrb_value x);
|
||||||
mrb_value mrb_bint_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
|
mrb_value mrb_bint_add_d(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
|
mrb_value mrb_bint_sub_d(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_div(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_div(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_divmod(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_divmod(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_add_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
mrb_value mrb_bint_add_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||||
mrb_value mrb_bint_sub_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
mrb_value mrb_bint_sub_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||||
mrb_value mrb_bint_mul_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
mrb_value mrb_bint_mul_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||||
mrb_value mrb_bint_div_ii(mrb_state *mrb, mrb_int x, mrb_int y);
|
|
||||||
mrb_value mrb_bint_mod(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_mod(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_rem(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_rem(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_pow(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_pow(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_powm(mrb_state *mrb, mrb_value x, mrb_int y, mrb_value z);
|
mrb_value mrb_bint_powm(mrb_state *mrb, mrb_value x, mrb_value y, mrb_value z);
|
||||||
mrb_value mrb_bint_and(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_and(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_or(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_or(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
mrb_value mrb_bint_xor(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_value mrb_bint_xor(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
@@ -198,6 +222,12 @@ mrb_value mrb_bint_new_float(mrb_state *mrb, mrb_float x);
|
|||||||
mrb_float mrb_bint_as_float(mrb_state *mrb, mrb_value x);
|
mrb_float mrb_bint_as_float(mrb_state *mrb, mrb_value x);
|
||||||
#endif
|
#endif
|
||||||
mrb_int mrb_bint_as_int(mrb_state *mrb, mrb_value x);
|
mrb_int mrb_bint_as_int(mrb_state *mrb, mrb_value x);
|
||||||
|
#ifdef MRB_INT64
|
||||||
|
#define mrb_bint_as_int64(mrb, x) mrb_bint_as_int((mrb), (x))
|
||||||
|
#else
|
||||||
|
int64_t mrb_bint_as_int64(mrb_state *mrb, mrb_value x);
|
||||||
|
#endif
|
||||||
|
uint64_t mrb_bint_as_uint64(mrb_state *mrb, mrb_value x);
|
||||||
mrb_int mrb_bint_cmp(mrb_state *mrb, mrb_value x, mrb_value y);
|
mrb_int mrb_bint_cmp(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
void mrb_gc_free_bint(mrb_state *mrb, struct RBasic *x);
|
void mrb_gc_free_bint(mrb_state *mrb, struct RBasic *x);
|
||||||
void mrb_bint_copy(mrb_state *mrb, mrb_value x, mrb_value y);
|
void mrb_bint_copy(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||||
|
|||||||
@@ -104,13 +104,13 @@ MRB_API mrb_value mrb_load_irep(mrb_state*, const uint8_t*);
|
|||||||
MRB_API mrb_value mrb_load_irep_buf(mrb_state*, const void*, size_t);
|
MRB_API mrb_value mrb_load_irep_buf(mrb_state*, const void*, size_t);
|
||||||
|
|
||||||
/* @param [const uint8_t*] irep code, expected as a literal */
|
/* @param [const uint8_t*] irep code, expected as a literal */
|
||||||
MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
|
MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrb_ccontext*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @param [const void*] irep code
|
* @param [const void*] irep code
|
||||||
* @param [size_t] size of irep buffer.
|
* @param [size_t] size of irep buffer.
|
||||||
*/
|
*/
|
||||||
MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrbc_context*);
|
MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrb_ccontext*);
|
||||||
|
|
||||||
struct mrb_insn_data {
|
struct mrb_insn_data {
|
||||||
uint8_t insn;
|
uint8_t insn;
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
|
|||||||
uint8_t *p = (uint8_t*)mrb_malloc_simple(mrb, sizeof(uint8_t)*sz/4+len*sz); \
|
uint8_t *p = (uint8_t*)mrb_malloc_simple(mrb, sizeof(uint8_t)*sz/4+len*sz); \
|
||||||
if (!p) { return 1; } \
|
if (!p) { return 1; } \
|
||||||
h->size = 0; \
|
h->size = 0; \
|
||||||
h->keys = (khkey_t *)p; \
|
h->keys = (khkey_t*)p; \
|
||||||
h->vals = kh_is_map ? (khval_t *)(p+sizeof(khkey_t)*sz) : NULL; \
|
h->vals = kh_is_map ? (khval_t*)(p+sizeof(khkey_t)*sz) : NULL; \
|
||||||
h->ed_flags = p+len*sz; \
|
h->ed_flags = p+len*sz; \
|
||||||
kh_fill_flags(h->ed_flags, 0xaa, sz/4); \
|
kh_fill_flags(h->ed_flags, 0xaa, sz/4); \
|
||||||
return 0; \
|
return 0; \
|
||||||
@@ -171,7 +171,7 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
|
|||||||
hh.n_buckets = new_n_buckets; \
|
hh.n_buckets = new_n_buckets; \
|
||||||
kh_alloc_##name(mrb, &hh); \
|
kh_alloc_##name(mrb, &hh); \
|
||||||
/* relocate */ \
|
/* relocate */ \
|
||||||
for (i=0 ; i<old_n_buckets ; i++) { \
|
for (i=0; i<old_n_buckets; i++) { \
|
||||||
if (!__ac_iseither(old_ed_flags, i)) { \
|
if (!__ac_iseither(old_ed_flags, i)) { \
|
||||||
khint_t k = kh_put_##name(mrb, &hh, old_keys[i], NULL); \
|
khint_t k = kh_put_##name(mrb, &hh, old_keys[i], NULL); \
|
||||||
if (kh_is_map) kh_value(&hh,k) = old_vals[i]; \
|
if (kh_is_map) kh_value(&hh,k) = old_vals[i]; \
|
||||||
@@ -271,7 +271,7 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
|
|||||||
static inline khint_t __ac_X31_hash_string(const char *s)
|
static inline khint_t __ac_X31_hash_string(const char *s)
|
||||||
{
|
{
|
||||||
khint_t h = *s;
|
khint_t h = *s;
|
||||||
if (h) for (++s ; *s; ++s) h = (h << 5) - h + *s;
|
if (h) for (++s; *s; ++s) h = (h << 5) - h + *s;
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
#define kh_str_hash_func(mrb,key) __ac_X31_hash_string(key)
|
#define kh_str_hash_func(mrb,key) __ac_X31_hash_string(key)
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ enum mrb_insn {
|
|||||||
#define OP_L_LAMBDA (OP_L_STRICT|OP_L_CAPTURE)
|
#define OP_L_LAMBDA (OP_L_STRICT|OP_L_CAPTURE)
|
||||||
#define OP_L_BLOCK OP_L_CAPTURE
|
#define OP_L_BLOCK OP_L_CAPTURE
|
||||||
|
|
||||||
#define OP_R_NORMAL 0
|
|
||||||
#define OP_R_BREAK 1
|
|
||||||
#define OP_R_RETURN 2
|
|
||||||
|
|
||||||
#define PEEK_B(pc) (*(pc))
|
#define PEEK_B(pc) (*(pc))
|
||||||
#define PEEK_S(pc) ((pc)[0]<<8|(pc)[1])
|
#define PEEK_S(pc) ((pc)[0]<<8|(pc)[1])
|
||||||
#define PEEK_W(pc) ((pc)[0]<<16|(pc)[1]<<8|(pc)[2])
|
#define PEEK_W(pc) ((pc)[0]<<16|(pc)[1]<<8|(pc)[2])
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ struct RProc {
|
|||||||
union {
|
union {
|
||||||
const mrb_irep *irep;
|
const mrb_irep *irep;
|
||||||
mrb_func_t func;
|
mrb_func_t func;
|
||||||
|
mrb_sym mid;
|
||||||
} body;
|
} body;
|
||||||
const struct RProc *upper;
|
const struct RProc *upper;
|
||||||
union {
|
union {
|
||||||
@@ -86,6 +87,8 @@ struct RProc {
|
|||||||
#define MRB_PROC_SCOPE_P(p) (((p)->flags & MRB_PROC_SCOPE) != 0)
|
#define MRB_PROC_SCOPE_P(p) (((p)->flags & MRB_PROC_SCOPE) != 0)
|
||||||
#define MRB_PROC_NOARG 4096 /* for MRB_PROC_CFUNC_FL, it would be something like MRB_ARGS_NONE() or MRB_METHOD_NOARG_FL */
|
#define MRB_PROC_NOARG 4096 /* for MRB_PROC_CFUNC_FL, it would be something like MRB_ARGS_NONE() or MRB_METHOD_NOARG_FL */
|
||||||
#define MRB_PROC_NOARG_P(p) (((p)->flags & MRB_PROC_NOARG) != 0)
|
#define MRB_PROC_NOARG_P(p) (((p)->flags & MRB_PROC_NOARG) != 0)
|
||||||
|
#define MRB_PROC_ALIAS 8192
|
||||||
|
#define MRB_PROC_ALIAS_P(p) (((p)->flags & MRB_PROC_ALIAS) != 0)
|
||||||
|
|
||||||
#define mrb_proc_ptr(v) ((struct RProc*)(mrb_ptr(v)))
|
#define mrb_proc_ptr(v) ((struct RProc*)(mrb_ptr(v)))
|
||||||
|
|
||||||
@@ -136,6 +139,41 @@ MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx);
|
|||||||
|
|
||||||
MRB_API mrb_value mrb_load_proc(mrb_state *mrb, const struct RProc *proc);
|
MRB_API mrb_value mrb_load_proc(mrb_state *mrb, const struct RProc *proc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It can be used to isolate top-level scopes referenced by blocks generated by
|
||||||
|
* `mrb_load_string_cxt()` or similar called before entering the mruby VM (e.g. from `main()`).
|
||||||
|
* In that case, the `ci` parameter should be `mrb->c->cibase`.
|
||||||
|
*
|
||||||
|
* #include <mruby.h>
|
||||||
|
* #include <mruby/compile.h>
|
||||||
|
* #include <mruby/proc.h>
|
||||||
|
*
|
||||||
|
* int
|
||||||
|
* main(int argc, char **argv)
|
||||||
|
* {
|
||||||
|
* mrb_state *mrb;
|
||||||
|
* mrb_ccontext *cxt;
|
||||||
|
* mrb_value blk, ret;
|
||||||
|
*
|
||||||
|
* mrb = mrb_open();
|
||||||
|
* cxt = mrb_ccontext_new(mrb);
|
||||||
|
* blk = mrb_load_string_cxt(mrb, "x, y, z = 1, 2, 3; proc { [x, y, z] }", cxt);
|
||||||
|
* mrb_vm_ci_env_clear(mrb, mrb->c->cibase);
|
||||||
|
* mrb_load_string_cxt(mrb, "x, y, z = 4, 5, 6", cxt);
|
||||||
|
* ret = mrb_funcall(mrb, blk, "call", 0);
|
||||||
|
* mrb_p(mrb, ret); // => [1, 2, 3]
|
||||||
|
* // => [4, 5, 6] if `mrb_vm_ci_env_clear()` is commented out
|
||||||
|
* mrb_ccontext_free(mrb, cxt);
|
||||||
|
* mrb_close(mrb);
|
||||||
|
*
|
||||||
|
* return 0;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* The top-level local variable names stored in `mrb_ccontext` are retained.
|
||||||
|
* Use also `mrb_ccontext_cleanup_local_variables()` at the same time, if necessary.
|
||||||
|
*/
|
||||||
|
MRB_API void mrb_vm_ci_env_clear(mrb_state *mrb, mrb_callinfo *ci);
|
||||||
|
|
||||||
void mrb_vm_ci_proc_set(mrb_callinfo *ci, const struct RProc *p);
|
void mrb_vm_ci_proc_set(mrb_callinfo *ci, const struct RProc *p);
|
||||||
struct RClass * mrb_vm_ci_target_class(const mrb_callinfo *ci);
|
struct RClass * mrb_vm_ci_target_class(const mrb_callinfo *ci);
|
||||||
void mrb_vm_ci_target_class_set(mrb_callinfo *ci, struct RClass *tc);
|
void mrb_vm_ci_target_class_set(mrb_callinfo *ci, struct RClass *tc);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MRuby Value definition functions and macros.
|
* mruby Value definition functions and macros.
|
||||||
*/
|
*/
|
||||||
MRB_BEGIN_DECL
|
MRB_BEGIN_DECL
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ MRB_API int mrb_msvc_snprintf(char *s, size_t n, const char *format, ...);
|
|||||||
# define isinf(n) (!_finite(n) && !_isnan(n))
|
# define isinf(n) (!_finite(n) && !_isnan(n))
|
||||||
# define signbit(n) (_copysign(1.0, (n)) < 0.0)
|
# define signbit(n) (_copysign(1.0, (n)) < 0.0)
|
||||||
static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
|
static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
|
||||||
# define INFINITY (*(float *)&IEEE754_INFINITY_BITS_SINGLE)
|
# define INFINITY (*(float*)&IEEE754_INFINITY_BITS_SINGLE)
|
||||||
# define NAN ((float)(INFINITY - INFINITY))
|
# define NAN ((float)(INFINITY - INFINITY))
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -186,7 +186,7 @@ MRB_VTYPE_FOREACH(MRB_VTYPE_TYPEDEF)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract
|
* @abstract
|
||||||
* MRuby value boxing.
|
* mruby value boxing.
|
||||||
*
|
*
|
||||||
* Actual implementation depends on configured boxing type.
|
* Actual implementation depends on configured boxing type.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ MRB_BEGIN_DECL
|
|||||||
/*
|
/*
|
||||||
* The version of Ruby used by mruby.
|
* The version of Ruby used by mruby.
|
||||||
*/
|
*/
|
||||||
#define MRUBY_RUBY_VERSION "3.2"
|
#define MRUBY_RUBY_VERSION "3.3"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ruby engine.
|
* Ruby engine.
|
||||||
@@ -42,7 +42,7 @@ MRB_BEGIN_DECL
|
|||||||
/*
|
/*
|
||||||
* Minor release version number.
|
* Minor release version number.
|
||||||
*/
|
*/
|
||||||
#define MRUBY_RELEASE_MINOR 2
|
#define MRUBY_RELEASE_MINOR 3
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tiny release version number.
|
* Tiny release version number.
|
||||||
@@ -80,7 +80,7 @@ MRB_BEGIN_DECL
|
|||||||
/*
|
/*
|
||||||
* Release year.
|
* Release year.
|
||||||
*/
|
*/
|
||||||
#define MRUBY_RELEASE_YEAR 2023
|
#define MRUBY_RELEASE_YEAR 2024
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release month.
|
* Release month.
|
||||||
@@ -90,7 +90,7 @@ MRB_BEGIN_DECL
|
|||||||
/*
|
/*
|
||||||
* Release day.
|
* Release day.
|
||||||
*/
|
*/
|
||||||
#define MRUBY_RELEASE_DAY 24
|
#define MRUBY_RELEASE_DAY 14
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release date as a string.
|
* Release date as a string.
|
||||||
@@ -117,7 +117,7 @@ MRB_BEGIN_DECL
|
|||||||
#define MRUBY_BIRTH_YEAR 2010
|
#define MRUBY_BIRTH_YEAR 2010
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MRuby's authors.
|
* mruby's authors.
|
||||||
*/
|
*/
|
||||||
#define MRUBY_AUTHOR "mruby developers"
|
#define MRUBY_AUTHOR "mruby developers"
|
||||||
|
|
||||||
|
|||||||
+57
-10
@@ -1,12 +1,16 @@
|
|||||||
require "mruby/core_ext"
|
require "mruby/core_ext"
|
||||||
require "mruby/build/load_gems"
|
require "mruby/build/load_gems"
|
||||||
require "mruby/build/command"
|
require "mruby/build/command"
|
||||||
|
autoload :Find, "find"
|
||||||
|
|
||||||
module MRuby
|
module MRuby
|
||||||
autoload :Gem, "mruby/gem"
|
autoload :Gem, "mruby/gem"
|
||||||
autoload :Lockfile, "mruby/lockfile"
|
autoload :Lockfile, "mruby/lockfile"
|
||||||
autoload :Presym, "mruby/presym"
|
autoload :Presym, "mruby/presym"
|
||||||
|
|
||||||
|
INSTALL_PREFIX = ENV['PREFIX'] || ENV['INSTALL_PREFIX'] || '/usr/local'
|
||||||
|
INSTALL_DESTDIR = ENV['DESTDIR'] || ''
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def targets
|
def targets
|
||||||
@targets ||= {}
|
@targets ||= {}
|
||||||
@@ -97,6 +101,7 @@ module MRuby
|
|||||||
@file_separator = '/'
|
@file_separator = '/'
|
||||||
@build_dir = "#{build_dir}/#{@name}"
|
@build_dir = "#{build_dir}/#{@name}"
|
||||||
@gem_clone_dir = "#{build_dir}/repos/#{@name}"
|
@gem_clone_dir = "#{build_dir}/repos/#{@name}"
|
||||||
|
@install_prefix = nil
|
||||||
@defines = []
|
@defines = []
|
||||||
@cc = Command::Compiler.new(self, %w(.c), label: "CC")
|
@cc = Command::Compiler.new(self, %w(.c), label: "CC")
|
||||||
@cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp), label: "CXX")
|
@cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp), label: "CXX")
|
||||||
@@ -162,9 +167,7 @@ module MRuby
|
|||||||
def enable_debug
|
def enable_debug
|
||||||
compilers.each do |c|
|
compilers.each do |c|
|
||||||
c.defines += %w(MRB_DEBUG)
|
c.defines += %w(MRB_DEBUG)
|
||||||
if toolchains.any? { |toolchain| toolchain == "gcc" }
|
c.setup_debug(self)
|
||||||
c.flags += %w(-g3 -O0)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@mrbc.compile_options += ' -g'
|
@mrbc.compile_options += ' -g'
|
||||||
|
|
||||||
@@ -370,14 +373,35 @@ EOS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def define_installer(src)
|
def define_installer_outline(src, dst)
|
||||||
dst = "#{self.class.install_dir}/#{File.basename(src)}"
|
|
||||||
file dst => src do
|
file dst => src do
|
||||||
install_D src, dst
|
_pp "GEN", src.relative_path, dst.relative_path
|
||||||
|
mkdir_p(File.dirname(dst))
|
||||||
|
yield dst
|
||||||
end
|
end
|
||||||
dst
|
dst
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ENV['OS'] == 'Windows_NT'
|
||||||
|
def define_installer(src)
|
||||||
|
dst = "#{self.class.install_dir}/#{File.basename(src)}".pathmap("%X.bat")
|
||||||
|
define_installer_outline(src, dst) do
|
||||||
|
File.write dst, <<~BATCHFILE
|
||||||
|
@echo off
|
||||||
|
call "#{File.expand_path(src)}" %*
|
||||||
|
BATCHFILE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
def define_installer(src)
|
||||||
|
dst = "#{self.class.install_dir}/#{File.basename(src)}"
|
||||||
|
define_installer_outline(src, dst) do
|
||||||
|
File.unlink(dst) rescue nil
|
||||||
|
File.symlink(src.relative_path_from(self.class.install_dir), dst)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def define_installer_if_needed(bin)
|
def define_installer_if_needed(bin)
|
||||||
exe = exefile("#{build_dir}/bin/#{bin}")
|
exe = exefile("#{build_dir}/bin/#{bin}")
|
||||||
host? ? define_installer(exe) : exe
|
host? ? define_installer(exe) : exe
|
||||||
@@ -440,10 +464,10 @@ EOS
|
|||||||
def run_bintest
|
def run_bintest
|
||||||
puts ">>> Bintest #{name} <<<"
|
puts ">>> Bintest #{name} <<<"
|
||||||
targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir }
|
targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir }
|
||||||
targets << filename(".") if File.directory? "./bintest"
|
|
||||||
mrbc = @gems["mruby-bin-mrbc"] ? exefile("#{@build_dir}/bin/mrbc") : mrbcfile
|
mrbc = @gems["mruby-bin-mrbc"] ? exefile("#{@build_dir}/bin/mrbc") : mrbcfile
|
||||||
env = {"BUILD_DIR" => @build_dir, "MRBCFILE" => mrbc}
|
env = {"BUILD_DIR" => @build_dir, "MRBCFILE" => mrbc}
|
||||||
sh env, "ruby test/bintest.rb#{verbose_flag} #{targets.join ' '}"
|
bintest = File.join(MRUBY_ROOT, "test/bintest.rb")
|
||||||
|
sh env, "ruby #{bintest}#{verbose_flag} #{targets.join ' '}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_build_summary
|
def print_build_summary
|
||||||
@@ -485,6 +509,29 @@ EOS
|
|||||||
@internal
|
@internal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def each_header_files(&block)
|
||||||
|
return to_enum(__method__) unless block
|
||||||
|
|
||||||
|
basedir = File.join(MRUBY_ROOT, "include")
|
||||||
|
Find.find(basedir) do |d|
|
||||||
|
next unless File.file? d
|
||||||
|
yield d
|
||||||
|
end
|
||||||
|
|
||||||
|
@gems.each { |g| g.each_header_files(&block) }
|
||||||
|
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def install_prefix
|
||||||
|
@install_prefix || (self.name == "host" ? MRuby::INSTALL_PREFIX :
|
||||||
|
File.join(MRuby::INSTALL_PREFIX, "mruby/#{self.name}"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def install_prefix=(dir)
|
||||||
|
@install_prefix = dir&.to_s
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
attr_writer :presym
|
attr_writer :presym
|
||||||
@@ -554,7 +601,6 @@ EOS
|
|||||||
def run_bintest
|
def run_bintest
|
||||||
puts ">>> Bintest #{name} <<<"
|
puts ">>> Bintest #{name} <<<"
|
||||||
targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir }
|
targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir }
|
||||||
targets << filename(".") if File.directory? "./bintest"
|
|
||||||
mrbc = @gems["mruby-bin-mrbc"] ? exefile("#{@build_dir}/bin/mrbc") : mrbcfile
|
mrbc = @gems["mruby-bin-mrbc"] ? exefile("#{@build_dir}/bin/mrbc") : mrbcfile
|
||||||
|
|
||||||
emulator = @test_runner.command
|
emulator = @test_runner.command
|
||||||
@@ -565,7 +611,8 @@ EOS
|
|||||||
"MRBCFILE" => mrbc,
|
"MRBCFILE" => mrbc,
|
||||||
"EMULATOR" => @test_runner.emulator,
|
"EMULATOR" => @test_runner.emulator,
|
||||||
}
|
}
|
||||||
sh env, "ruby test/bintest.rb#{verbose_flag} #{targets.join ' '}"
|
bintest = File.join(MRUBY_ROOT, "test/bintest.rb")
|
||||||
|
sh env, "ruby #{bintest}#{verbose_flag} #{targets.join ' '}"
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|||||||
@@ -99,12 +99,16 @@ module MRuby
|
|||||||
gemrake = File.join(source_dir, "mrbgem.rake")
|
gemrake = File.join(source_dir, "mrbgem.rake")
|
||||||
rakedep = File.exist?(gemrake) ? [ gemrake ] : []
|
rakedep = File.exist?(gemrake) ? [ gemrake ] : []
|
||||||
|
|
||||||
if build_dir.include? "mrbgems/"
|
bd = build_dir
|
||||||
|
if bd.start_with?(MRUBY_ROOT)
|
||||||
|
bd = bd.sub(MRUBY_ROOT, '')
|
||||||
|
end
|
||||||
|
if bd.include? "mrbgems/"
|
||||||
generated_file_matcher = Regexp.new("^#{Regexp.escape build_dir}/(?!mrbc/)(.*)#{Regexp.escape out_ext}$")
|
generated_file_matcher = Regexp.new("^#{Regexp.escape build_dir}/(?!mrbc/)(.*)#{Regexp.escape out_ext}$")
|
||||||
else
|
else
|
||||||
generated_file_matcher = Regexp.new("^#{Regexp.escape build_dir}/(?!mrbc/|mrbgems/.+/)(.*)#{Regexp.escape out_ext}$")
|
generated_file_matcher = Regexp.new("^#{Regexp.escape build_dir}/(?!mrbc/|mrbgems/.+/)(.*)#{Regexp.escape out_ext}$")
|
||||||
end
|
end
|
||||||
source_exts.each do |ext, compile|
|
source_exts.each do |ext|
|
||||||
rule generated_file_matcher => [
|
rule generated_file_matcher => [
|
||||||
proc { |file|
|
proc { |file|
|
||||||
file.sub(generated_file_matcher, "#{source_dir}/\\1#{ext}")
|
file.sub(generated_file_matcher, "#{source_dir}/\\1#{ext}")
|
||||||
@@ -129,6 +133,12 @@ module MRuby
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This method can be redefined as a singleton method where appropriate.
|
||||||
|
# Manipulate `flags`, `include_paths` and/or more if necessary.
|
||||||
|
def setup_debug(conf)
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -335,7 +345,7 @@ module MRuby
|
|||||||
opt << " -s" if static
|
opt << " -s" if static
|
||||||
cmd = %["#{filename @command}" #{opt} #{filename(infiles).map{|f| %["#{f}"]}.join(' ')}]
|
cmd = %["#{filename @command}" #{opt} #{filename(infiles).map{|f| %["#{f}"]}.join(' ')}]
|
||||||
puts cmd if Rake.verbose
|
puts cmd if Rake.verbose
|
||||||
IO.popen(cmd, 'r+') do |io|
|
IO.popen(cmd, 'r') do |io|
|
||||||
out.puts io.read
|
out.puts io.read
|
||||||
end
|
end
|
||||||
# if mrbc execution fail, drop the file
|
# if mrbc execution fail, drop the file
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ module MRuby
|
|||||||
@build.gem_dir_to_repo_url[repo_dir] = url
|
@build.gem_dir_to_repo_url[repo_dir] = url
|
||||||
@build.locks[url] = {
|
@build.locks[url] = {
|
||||||
'url' => url,
|
'url' => url,
|
||||||
'branch' => @build.git.current_branch(repo_dir),
|
'branch' => branch || @build.git.current_branch(repo_dir),
|
||||||
'commit' => @build.git.commit_hash(repo_dir),
|
'commit' => @build.git.commit_hash(repo_dir),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,6 +22,27 @@ class String
|
|||||||
def remove_leading_parents
|
def remove_leading_parents
|
||||||
Pathname.new(".#{Pathname.new("/#{self}").cleanpath}").cleanpath.to_s
|
Pathname.new(".#{Pathname.new("/#{self}").cleanpath}").cleanpath.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def replace_prefix_by(dirmap)
|
||||||
|
[self].replace_prefix_by(dirmap)[0]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Array
|
||||||
|
# Replace the prefix of each string that is a file path that contains in its own array.
|
||||||
|
#
|
||||||
|
# dirmap is a hash whose elements are `{ "path/to/old-prefix" => "path/to/new-prefix", ... }`.
|
||||||
|
# If it does not match any element of dirmap, the file path is not replaced.
|
||||||
|
def replace_prefix_by(dirmap)
|
||||||
|
dirmap = dirmap.map { |older, newer| [File.join(older, "/"), File.join(newer, "/")] }
|
||||||
|
dirmap.sort!
|
||||||
|
dirmap.reverse!
|
||||||
|
self.flatten.map do |e|
|
||||||
|
map = dirmap.find { |older, newer| e.start_with?(older) }
|
||||||
|
e = e.sub(map[0], map[1]) if map
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_D(src, dst)
|
def install_D(src, dst)
|
||||||
|
|||||||
+21
-10
@@ -36,6 +36,7 @@ module MRuby
|
|||||||
attr_accessor :export_include_paths
|
attr_accessor :export_include_paths
|
||||||
|
|
||||||
attr_reader :generate_functions
|
attr_reader :generate_functions
|
||||||
|
attr_writer :skip_test
|
||||||
|
|
||||||
attr_block MRuby::Build::COMMANDS
|
attr_block MRuby::Build::COMMANDS
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ module MRuby
|
|||||||
|
|
||||||
@test_preload = nil # 'test/assert.rb'
|
@test_preload = nil # 'test/assert.rb'
|
||||||
@test_args = {}
|
@test_args = {}
|
||||||
|
@skip_test = false
|
||||||
|
|
||||||
@bins = []
|
@bins = []
|
||||||
@cdump = true
|
@cdump = true
|
||||||
@@ -87,6 +89,10 @@ module MRuby
|
|||||||
build.locks[repo_url]['version'] = version if repo_url
|
build.locks[repo_url]['version'] = version if repo_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def skip_test?
|
||||||
|
@skip_test
|
||||||
|
end
|
||||||
|
|
||||||
def setup_compilers
|
def setup_compilers
|
||||||
(core? ? [@cc, *(@cxx if build.cxx_exception_enabled?)] : compilers).each do |compiler|
|
(core? ? [@cc, *(@cxx if build.cxx_exception_enabled?)] : compilers).each do |compiler|
|
||||||
compiler.define_rules build_dir, @dir, @build.exts.presym_preprocessed if build.presym_enabled?
|
compiler.define_rules build_dir, @dir, @build.exts.presym_preprocessed if build.presym_enabled?
|
||||||
@@ -209,7 +215,6 @@ module MRuby
|
|||||||
f.puts %Q[void mrb_#{funcname}_gem_final(mrb_state *mrb);]
|
f.puts %Q[void mrb_#{funcname}_gem_final(mrb_state *mrb);]
|
||||||
f.puts %Q[]
|
f.puts %Q[]
|
||||||
f.puts %Q[void GENERATED_TMP_mrb_#{funcname}_gem_init(mrb_state *mrb) {]
|
f.puts %Q[void GENERATED_TMP_mrb_#{funcname}_gem_init(mrb_state *mrb) {]
|
||||||
f.puts %Q[ int ai = mrb_gc_arena_save(mrb);]
|
|
||||||
f.puts %Q[ gem_mrblib_#{funcname}_proc_init_syms(mrb);] if !rbfiles.empty? && cdump?
|
f.puts %Q[ gem_mrblib_#{funcname}_proc_init_syms(mrb);] if !rbfiles.empty? && cdump?
|
||||||
f.puts %Q[ mrb_#{funcname}_gem_init(mrb);] if objs != [objfile("#{build_dir}/gem_init")]
|
f.puts %Q[ mrb_#{funcname}_gem_init(mrb);] if objs != [objfile("#{build_dir}/gem_init")]
|
||||||
unless rbfiles.empty?
|
unless rbfiles.empty?
|
||||||
@@ -218,16 +223,7 @@ module MRuby
|
|||||||
else
|
else
|
||||||
f.puts %Q[ mrb_load_irep(mrb, gem_mrblib_irep_#{funcname});]
|
f.puts %Q[ mrb_load_irep(mrb, gem_mrblib_irep_#{funcname});]
|
||||||
end
|
end
|
||||||
f.puts %Q[ if (mrb->exc) {]
|
|
||||||
f.puts %Q[ mrb_print_error(mrb);]
|
|
||||||
f.puts %Q[ mrb_close(mrb);]
|
|
||||||
f.puts %Q[ exit(EXIT_FAILURE);]
|
|
||||||
f.puts %Q[ }]
|
|
||||||
f.puts %Q[ struct REnv *e = mrb_vm_ci_env(mrb->c->cibase);]
|
|
||||||
f.puts %Q[ mrb_vm_ci_env_set(mrb->c->cibase, NULL);]
|
|
||||||
f.puts %Q[ mrb_env_unshare(mrb, e, FALSE);]
|
|
||||||
end
|
end
|
||||||
f.puts %Q[ mrb_gc_arena_restore(mrb, ai);]
|
|
||||||
f.puts %Q[}]
|
f.puts %Q[}]
|
||||||
f.puts %Q[]
|
f.puts %Q[]
|
||||||
f.puts %Q[void GENERATED_TMP_mrb_#{funcname}_gem_final(mrb_state *mrb) {]
|
f.puts %Q[void GENERATED_TMP_mrb_#{funcname}_gem_final(mrb_state *mrb) {]
|
||||||
@@ -241,6 +237,8 @@ module MRuby
|
|||||||
f.puts %Q[ * This file is loading the irep]
|
f.puts %Q[ * This file is loading the irep]
|
||||||
f.puts %Q[ * Ruby GEM code.]
|
f.puts %Q[ * Ruby GEM code.]
|
||||||
f.puts %Q[ *]
|
f.puts %Q[ *]
|
||||||
|
f.puts %Q[ * This file was generated by mruby/#{__FILE__.relative_path_from(MRUBY_ROOT)}.]
|
||||||
|
f.puts %Q[ *]
|
||||||
f.puts %Q[ * IMPORTANT:]
|
f.puts %Q[ * IMPORTANT:]
|
||||||
f.puts %Q[ * This file was generated!]
|
f.puts %Q[ * This file was generated!]
|
||||||
f.puts %Q[ * All manual changes will get lost.]
|
f.puts %Q[ * All manual changes will get lost.]
|
||||||
@@ -292,6 +290,19 @@ module MRuby
|
|||||||
end
|
end
|
||||||
end.all?
|
end.all?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def each_header_files(&block)
|
||||||
|
return to_enum(__method__) unless block
|
||||||
|
|
||||||
|
self.export_include_paths.flatten.uniq.compact.each do |dir|
|
||||||
|
Find.find(dir) do |d|
|
||||||
|
next unless File.file? d
|
||||||
|
yield d
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self
|
||||||
|
end
|
||||||
end # Specification
|
end # Specification
|
||||||
|
|
||||||
class Version
|
class Version
|
||||||
|
|||||||
+38
-2
@@ -46,6 +46,18 @@ module MRuby
|
|||||||
|
|
||||||
C_STR_LITERAL_RE = /"(?:[^\\\"]|\\.)*"/
|
C_STR_LITERAL_RE = /"(?:[^\\\"]|\\.)*"/
|
||||||
|
|
||||||
|
ESCAPE_SEQUENCE_MAP = {
|
||||||
|
"a" => "\a",
|
||||||
|
"b" => "\b",
|
||||||
|
"e" => "\e",
|
||||||
|
"f" => "\f",
|
||||||
|
"n" => "\n",
|
||||||
|
"r" => "\r",
|
||||||
|
"t" => "\t",
|
||||||
|
"v" => "\v",
|
||||||
|
}
|
||||||
|
ESCAPE_SEQUENCE_MAP.keys.each { |k| ESCAPE_SEQUENCE_MAP[ESCAPE_SEQUENCE_MAP[k]] = k }
|
||||||
|
|
||||||
def initialize(build)
|
def initialize(build)
|
||||||
@build = build
|
@build = build
|
||||||
end
|
end
|
||||||
@@ -93,7 +105,18 @@ module MRuby
|
|||||||
f.puts "};"
|
f.puts "};"
|
||||||
f.puts
|
f.puts
|
||||||
f.puts "static const char * const presym_name_table[] = {"
|
f.puts "static const char * const presym_name_table[] = {"
|
||||||
presyms.each{|sym| f.puts %| "#{sym}",|}
|
presyms.each do |sym|
|
||||||
|
sym = sym.gsub(/([\x01-\x1f\x7f-\xff])|("|\\)/n) {
|
||||||
|
case
|
||||||
|
when $1
|
||||||
|
e = ESCAPE_SEQUENCE_MAP[$1]
|
||||||
|
e ? "\\#{e}" : '\\x%02x""' % $1.ord
|
||||||
|
when $2
|
||||||
|
"\\#$2"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
f.puts %| "#{sym}",|
|
||||||
|
end
|
||||||
f.puts "};"
|
f.puts "};"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -119,7 +142,20 @@ module MRuby
|
|||||||
def read_preprocessed(presym_hash, path)
|
def read_preprocessed(presym_hash, path)
|
||||||
File.binread(path).scan(/<@! (.*?) !@>/) do |part,|
|
File.binread(path).scan(/<@! (.*?) !@>/) do |part,|
|
||||||
literals = part.scan(C_STR_LITERAL_RE)
|
literals = part.scan(C_STR_LITERAL_RE)
|
||||||
presym_hash[literals.map{|l| l[1..-2]}.join] = true unless literals.empty?
|
unless literals.empty?
|
||||||
|
literals = literals.map{|l| l[1..-2]}
|
||||||
|
literals.each do |e|
|
||||||
|
e.gsub!(/\\x([0-9A-Fa-f]{1,2})|\\(0[0-7]{,3})|\\([abefnrtv])|\\(.)/) do
|
||||||
|
case
|
||||||
|
when $1; $1.hex.chr(Encoding::BINARY)
|
||||||
|
when $2; $2.oct.chr(Encoding::BINARY)
|
||||||
|
when $3; ESCAPE_SEQUENCE_MAP[$3]
|
||||||
|
when $4; $4
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
presym_hash[literals.join] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ MRuby::GemBox.new do |conf|
|
|||||||
# Generate mrbc command
|
# Generate mrbc command
|
||||||
conf.gem :core => "mruby-bin-mrbc"
|
conf.gem :core => "mruby-bin-mrbc"
|
||||||
|
|
||||||
|
# Generate mrdb command
|
||||||
|
conf.gem :core => "mruby-bin-debugger"
|
||||||
|
|
||||||
# Generate mirb command
|
# Generate mirb command
|
||||||
conf.gem :core => "mruby-bin-mirb"
|
conf.gem :core => "mruby-bin-mirb"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MRuby::GemBox.new do |conf|
|
MRuby::GemBox.new do |conf|
|
||||||
Dir.glob("#{root}/mrbgems/mruby-*/mrbgem.rake") do |x|
|
Dir.glob("#{root}/mrbgems/mruby-*/mrbgem.rake") do |x|
|
||||||
g = File.basename File.dirname x
|
g = File.basename(File.dirname(x))
|
||||||
conf.gem :core => g unless g =~ /^mruby-(?:bin-debugger|test)$/
|
conf.gem :core => g unless g =~ /^mruby-(?:bin-debugger|test)$/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -820,7 +820,7 @@ class Array
|
|||||||
return to_enum(:combination, n) unless block
|
return to_enum(:combination, n) unless block
|
||||||
size = self.size
|
size = self.size
|
||||||
if n == 0
|
if n == 0
|
||||||
yield []
|
yield []
|
||||||
elsif n == 1
|
elsif n == 1
|
||||||
i = 0
|
i = 0
|
||||||
while i<size
|
while i<size
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_assoc(mrb_state *mrb, mrb_value ary)
|
ary_assoc(mrb_state *mrb, mrb_value ary)
|
||||||
{
|
{
|
||||||
mrb_int i;
|
mrb_int i;
|
||||||
mrb_value v;
|
mrb_value v;
|
||||||
@@ -57,7 +57,7 @@ mrb_ary_assoc(mrb_state *mrb, mrb_value ary)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_rassoc(mrb_state *mrb, mrb_value ary)
|
ary_rassoc(mrb_state *mrb, mrb_value ary)
|
||||||
{
|
{
|
||||||
mrb_int i;
|
mrb_int i;
|
||||||
mrb_value v;
|
mrb_value v;
|
||||||
@@ -87,10 +87,9 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_at(mrb_state *mrb, mrb_value ary)
|
ary_at(mrb_state *mrb, mrb_value ary)
|
||||||
{
|
{
|
||||||
mrb_int pos;
|
mrb_int pos = mrb_as_int(mrb, mrb_get_arg1(mrb));
|
||||||
mrb_get_args(mrb, "i", &pos);
|
|
||||||
|
|
||||||
return mrb_ary_entry(ary, pos);
|
return mrb_ary_entry(ary, pos);
|
||||||
}
|
}
|
||||||
@@ -102,7 +101,7 @@ ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_values_at(mrb_state *mrb, mrb_value self)
|
ary_values_at(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
mrb_int argc = mrb_get_argc(mrb);
|
mrb_int argc = mrb_get_argc(mrb);
|
||||||
const mrb_value *argv = mrb_get_argv(mrb);
|
const mrb_value *argv = mrb_get_argv(mrb);
|
||||||
@@ -134,7 +133,7 @@ mrb_value mrb_ary_delete_at(mrb_state *mrb, mrb_value self);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_slice_bang(mrb_state *mrb, mrb_value self)
|
ary_slice_bang(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
struct RArray *a = mrb_ary_ptr(self);
|
struct RArray *a = mrb_ary_ptr(self);
|
||||||
mrb_int i, j, len, alen;
|
mrb_int i, j, len, alen;
|
||||||
@@ -187,7 +186,7 @@ mrb_ary_slice_bang(mrb_state *mrb, mrb_value self)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_compact(mrb_state *mrb, mrb_value self)
|
ary_compact(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
mrb_value ary = mrb_ary_new(mrb);
|
mrb_value ary = mrb_ary_new(mrb);
|
||||||
mrb_int len = RARRAY_LEN(self);
|
mrb_int len = RARRAY_LEN(self);
|
||||||
@@ -213,14 +212,14 @@ mrb_ary_compact(mrb_state *mrb, mrb_value self)
|
|||||||
* [ "a", "b", "c" ].compact! #=> nil
|
* [ "a", "b", "c" ].compact! #=> nil
|
||||||
*/
|
*/
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_compact_bang(mrb_state *mrb, mrb_value self)
|
ary_compact_bang(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
struct RArray *a = mrb_ary_ptr(self);
|
struct RArray *a = mrb_ary_ptr(self);
|
||||||
mrb_int i, j = 0;
|
mrb_int i, j = 0;
|
||||||
mrb_int len = ARY_LEN(a);
|
mrb_int len = ARY_LEN(a);
|
||||||
mrb_value *p = ARY_PTR(a);
|
|
||||||
|
|
||||||
mrb_ary_modify(mrb, a);
|
mrb_ary_modify(mrb, a);
|
||||||
|
mrb_value *p = ARY_PTR(a);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (!mrb_nil_p(p[i])) {
|
if (!mrb_nil_p(p[i])) {
|
||||||
if (i != j) p[j] = p[i];
|
if (i != j) p[j] = p[i];
|
||||||
@@ -228,7 +227,7 @@ mrb_ary_compact_bang(mrb_state *mrb, mrb_value self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == j) return mrb_nil_value();
|
if (i == j) return mrb_nil_value();
|
||||||
if (j < len) ARY_SET_LEN(RARRAY(self), j);
|
ARY_SET_LEN(RARRAY(self), j);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +249,7 @@ mrb_ary_compact_bang(mrb_state *mrb, mrb_value self)
|
|||||||
* a.rotate(-3) #=> ["b", "c", "d", "a"]
|
* a.rotate(-3) #=> ["b", "c", "d", "a"]
|
||||||
*/
|
*/
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_rotate(mrb_state *mrb, mrb_value self)
|
ary_rotate(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
mrb_int count=1;
|
mrb_int count=1;
|
||||||
mrb_get_args(mrb, "|i", &count);
|
mrb_get_args(mrb, "|i", &count);
|
||||||
@@ -301,17 +300,17 @@ rev(mrb_value *p, mrb_int beg, mrb_int end)
|
|||||||
* a.rotate!(-3) #=> ["a", "b", "c", "d"]
|
* a.rotate!(-3) #=> ["a", "b", "c", "d"]
|
||||||
*/
|
*/
|
||||||
static mrb_value
|
static mrb_value
|
||||||
mrb_ary_rotate_bang(mrb_state *mrb, mrb_value self)
|
ary_rotate_bang(mrb_state *mrb, mrb_value self)
|
||||||
{
|
{
|
||||||
mrb_int count=1;
|
mrb_int count=1;
|
||||||
mrb_get_args(mrb, "|i", &count);
|
mrb_get_args(mrb, "|i", &count);
|
||||||
|
|
||||||
struct RArray *a = mrb_ary_ptr(self);
|
struct RArray *a = mrb_ary_ptr(self);
|
||||||
mrb_int len = ARY_LEN(a);
|
mrb_int len = ARY_LEN(a);
|
||||||
mrb_value *p = ARY_PTR(a);
|
|
||||||
mrb_int idx;
|
mrb_int idx;
|
||||||
|
|
||||||
mrb_ary_modify(mrb, a);
|
mrb_ary_modify(mrb, a);
|
||||||
|
mrb_value *p = ARY_PTR(a);
|
||||||
if (len == 0 || count == 0) return self;
|
if (len == 0 || count == 0) return self;
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
mrb_value v = p[0];
|
mrb_value v = p[0];
|
||||||
@@ -347,15 +346,15 @@ mrb_mruby_array_ext_gem_init(mrb_state* mrb)
|
|||||||
{
|
{
|
||||||
struct RClass * a = mrb->array_class;
|
struct RClass * a = mrb->array_class;
|
||||||
|
|
||||||
mrb_define_method(mrb, a, "assoc", mrb_ary_assoc, MRB_ARGS_REQ(1));
|
mrb_define_method(mrb, a, "assoc", ary_assoc, MRB_ARGS_REQ(1));
|
||||||
mrb_define_method(mrb, a, "at", mrb_ary_at, MRB_ARGS_REQ(1));
|
mrb_define_method(mrb, a, "at", ary_at, MRB_ARGS_REQ(1));
|
||||||
mrb_define_method(mrb, a, "rassoc", mrb_ary_rassoc, MRB_ARGS_REQ(1));
|
mrb_define_method(mrb, a, "rassoc", ary_rassoc, MRB_ARGS_REQ(1));
|
||||||
mrb_define_method(mrb, a, "values_at", mrb_ary_values_at, MRB_ARGS_ANY());
|
mrb_define_method(mrb, a, "values_at", ary_values_at, MRB_ARGS_ANY());
|
||||||
mrb_define_method(mrb, a, "slice!", mrb_ary_slice_bang, MRB_ARGS_ARG(1,1));
|
mrb_define_method(mrb, a, "slice!", ary_slice_bang, MRB_ARGS_ARG(1,1));
|
||||||
mrb_define_method(mrb, a, "compact", mrb_ary_compact, MRB_ARGS_NONE());
|
mrb_define_method(mrb, a, "compact", ary_compact, MRB_ARGS_NONE());
|
||||||
mrb_define_method(mrb, a, "compact!", mrb_ary_compact_bang, MRB_ARGS_NONE());
|
mrb_define_method(mrb, a, "compact!", ary_compact_bang, MRB_ARGS_NONE());
|
||||||
mrb_define_method(mrb, a, "rotate", mrb_ary_rotate, MRB_ARGS_OPT(1));
|
mrb_define_method(mrb, a, "rotate", ary_rotate, MRB_ARGS_OPT(1));
|
||||||
mrb_define_method(mrb, a, "rotate!", mrb_ary_rotate_bang, MRB_ARGS_OPT(1));
|
mrb_define_method(mrb, a, "rotate!", ary_rotate_bang, MRB_ARGS_OPT(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ Thanks also to Erick Gallesio <eg@kaolin.unice.fr> for a fix
|
|||||||
to mpz_init_set_str
|
to mpz_init_set_str
|
||||||
|
|
||||||
Define B64 if your "long" type is 64 bits. Otherwise we assume 32
|
Define B64 if your "long" type is 64 bits. Otherwise we assume 32
|
||||||
bit longs. (The 64 bit version hasn't been tested enough)
|
bit longs. (The 64-bit version hasn't been tested enough)
|
||||||
|
|
||||||
```
|
```
|
||||||
Platforms:
|
Platforms:
|
||||||
@@ -73,18 +73,18 @@ MS-DOS 286 C compiler (see credits above)
|
|||||||
|
|
||||||
1. fgmp is considerably slower than gmp
|
1. fgmp is considerably slower than gmp
|
||||||
2. fgmp does not implement the following:
|
2. fgmp does not implement the following:
|
||||||
all mpq_*
|
- all mpq\_\*
|
||||||
internal mpn_* functions
|
- internal mpn\_\* functions
|
||||||
mpz_perfect_square_p
|
- mpz_perfect_square_p
|
||||||
mpz_inp_raw, mpz_out_raw
|
- mpz_inp_raw, mpz_out_raw
|
||||||
mp_set_memory_functions, mpz_out_str, mpz_inp_str
|
- mp_set_memory_functions, mpz_out_str, mpz_inp_str
|
||||||
3. fgmp implements the following in addition to the routines in GNU gmp.
|
3. fgmp implements the following in addition to the routines in GNU gmp.
|
||||||
`int mpz_jacobi(MP_INT *a, MP_INT *b)`
|
`int mpz_jacobi(MP_INT *a, MP_INT *b)`
|
||||||
- finds the jacobi symbol (a/b)
|
- finds the jacobi symbol (a/b)
|
||||||
4. mpz_sizeinbase often overestimates the exact value
|
4. mpz_sizeinbase often overestimates the exact value
|
||||||
|
|
||||||
5. To convert your gmp based program to fgmp (subject to the
|
5. To convert your gmp based program to fgmp (subject to the
|
||||||
above)
|
above)
|
||||||
|
|
||||||
- recompile your source. Make sure to include the gmp.h file included
|
- recompile your source. Make sure to include the gmp.h file included
|
||||||
with fgmp rather than that included with gmp. (The point is to recompile
|
with fgmp rather than that included with gmp. (The point is to recompile
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ mpz_set_int(mrb_state *mrb, mpz_t *y, mrb_int v)
|
|||||||
y->sn = 1;
|
y->sn = 1;
|
||||||
u = v;
|
u = v;
|
||||||
}
|
}
|
||||||
if (v < 0) {
|
else /* if (v < 0) */ {
|
||||||
y->sn = -1;
|
y->sn = -1;
|
||||||
if (v == MRB_INT_MIN) u = v;
|
if (v == MRB_INT_MIN) u = v;
|
||||||
else u = -v;
|
else u = -v;
|
||||||
@@ -97,6 +97,39 @@ mpz_set_int(mrb_state *mrb, mpz_t *y, mrb_int v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mpz_set_uint64(mrb_state *mrb, mpz_t *y, uint64_t u)
|
||||||
|
{
|
||||||
|
const size_t len = sizeof(uint64_t) / sizeof(mp_limb);
|
||||||
|
|
||||||
|
y->sn = (u != 0);
|
||||||
|
mpz_realloc(mrb, y, len);
|
||||||
|
for (size_t i=0; i<len; i++) {
|
||||||
|
y->p[i++] = (mp_limb)LOW(u);
|
||||||
|
u >>= DIG_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MRB_INT32
|
||||||
|
static void
|
||||||
|
mpz_set_int64(mrb_state *mrb, mpz_t *y, int64_t v)
|
||||||
|
{
|
||||||
|
uint64_t u;
|
||||||
|
|
||||||
|
if (v < 0) {
|
||||||
|
if (v == INT64_MIN) u = v;
|
||||||
|
else u = -v;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u = v;
|
||||||
|
}
|
||||||
|
mpz_set_uint64(mrb, y, u);
|
||||||
|
if (v < 0) {
|
||||||
|
y->sn = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mpz_init_set_int(mrb_state *mrb, mpz_t *y, mrb_int v)
|
mpz_init_set_int(mrb_state *mrb, mpz_t *y, mrb_int v)
|
||||||
{
|
{
|
||||||
@@ -131,7 +164,7 @@ digits(mpz_t *x)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (x->sz == 0) return 0;
|
if (x->sz == 0) return 0;
|
||||||
for (i = x->sz - 1; x->p[i] == 0 ; i--)
|
for (i = x->sz - 1; x->p[i] == 0; i--)
|
||||||
if (i == 0) break;
|
if (i == 0) break;
|
||||||
return i+1;
|
return i+1;
|
||||||
}
|
}
|
||||||
@@ -362,7 +395,7 @@ lzb(mp_limb x)
|
|||||||
|
|
||||||
int j=0;
|
int j=0;
|
||||||
|
|
||||||
for (mp_limb i = ((mp_limb)1 << (DIG_SIZE-1)); i && !(x&i) ; j++,i>>=1)
|
for (mp_limb i = ((mp_limb)1 << (DIG_SIZE-1)); i && !(x&i); j++,i>>=1)
|
||||||
;
|
;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
@@ -909,7 +942,41 @@ mpz_pow(mrb_state *mrb, mpz_t *zz, mpz_t *x, mrb_int e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mpz_powm(mrb_state *mrb, mpz_t *zz, mpz_t *x, mrb_int ex, mpz_t *n)
|
mpz_powm(mrb_state *mrb, mpz_t *zz, mpz_t *x, mpz_t *ex, mpz_t *n)
|
||||||
|
{
|
||||||
|
mpz_t t, b;
|
||||||
|
|
||||||
|
if (uzero(ex)) {
|
||||||
|
mpz_set_int(mrb, zz, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ex->sn < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mpz_init_set_int(mrb, &t, 1);
|
||||||
|
mpz_init_set(mrb, &b, x);
|
||||||
|
|
||||||
|
size_t len = digits(ex);
|
||||||
|
for (size_t i=0; i<len; i++) {
|
||||||
|
mp_limb e = ex->p[i];
|
||||||
|
for (size_t j=0; j<sizeof(mp_limb)*8; j++) {
|
||||||
|
if ((e & 1) == 1) {
|
||||||
|
mpz_mul(mrb, &t, &t, &b);
|
||||||
|
mpz_mod(mrb, &t, &t, n);
|
||||||
|
}
|
||||||
|
e >>= 1;
|
||||||
|
mpz_mul(mrb, &b, &b, &b);
|
||||||
|
mpz_mod(mrb, &b, &b, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mpz_move(mrb, zz, &t);
|
||||||
|
mpz_clear(mrb, &b);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mpz_powm_i(mrb_state *mrb, mpz_t *zz, mpz_t *x, mrb_int ex, mpz_t *n)
|
||||||
{
|
{
|
||||||
mpz_t t, b;
|
mpz_t t, b;
|
||||||
|
|
||||||
@@ -955,13 +1022,6 @@ bint_new_int(mrb_state *mrb, mrb_int x)
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
|
||||||
mrb_bint_new(mrb_state *mrb)
|
|
||||||
{
|
|
||||||
struct RBigint *b = bint_new(mrb);
|
|
||||||
return mrb_obj_value(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
mrb_bint_new_int(mrb_state *mrb, mrb_int x)
|
mrb_bint_new_int(mrb_state *mrb, mrb_int x)
|
||||||
{
|
{
|
||||||
@@ -969,6 +1029,26 @@ mrb_bint_new_int(mrb_state *mrb, mrb_int x)
|
|||||||
return mrb_obj_value(b);
|
return mrb_obj_value(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MRB_INT32
|
||||||
|
mrb_value
|
||||||
|
mrb_bint_new_int64(mrb_state *mrb, int64_t x)
|
||||||
|
{
|
||||||
|
struct RBigint *b = bint_new(mrb);
|
||||||
|
mpz_init(mrb, &b->mp);
|
||||||
|
mpz_set_int64(mrb, &b->mp, x);
|
||||||
|
return mrb_obj_value(b);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mrb_value
|
||||||
|
mrb_bint_new_uint64(mrb_state *mrb, uint64_t x)
|
||||||
|
{
|
||||||
|
struct RBigint *b = bint_new(mrb);
|
||||||
|
mpz_init(mrb, &b->mp);
|
||||||
|
mpz_set_uint64(mrb, &b->mp, x);
|
||||||
|
return mrb_obj_value(b);
|
||||||
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
mrb_bint_new_str(mrb_state *mrb, const char *x, mrb_int len, mrb_int base)
|
mrb_bint_new_str(mrb_state *mrb, const char *x, mrb_int len, mrb_int base)
|
||||||
{
|
{
|
||||||
@@ -1086,6 +1166,61 @@ mrb_bint_as_int(mrb_state *mrb, mrb_value x)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MRB_INT32
|
||||||
|
int64_t
|
||||||
|
mrb_bint_as_int64(mrb_state *mrb, mrb_value x)
|
||||||
|
{
|
||||||
|
struct RBigint *b = RBIGINT(x);
|
||||||
|
mpz_t *m = &b->mp;
|
||||||
|
uint64_t u = 0;
|
||||||
|
size_t len = digits(m);
|
||||||
|
|
||||||
|
if (len*sizeof(mp_limb) > sizeof(uint64_t)) {
|
||||||
|
out_of_range:
|
||||||
|
mrb_raise(mrb, E_RANGE_ERROR, "integer out of range");
|
||||||
|
}
|
||||||
|
for (size_t i=len-1; ; i--) {
|
||||||
|
u <<= DIG_SIZE;
|
||||||
|
u |= m->p[i];
|
||||||
|
if (i==0) break;
|
||||||
|
}
|
||||||
|
if (u > INT64_MAX) goto out_of_range;
|
||||||
|
if (m->sn < 0) return -(int64_t)u;
|
||||||
|
return (int64_t)u;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint64_t
|
||||||
|
mrb_bint_as_uint64(mrb_state *mrb, mrb_value x)
|
||||||
|
{
|
||||||
|
struct RBigint *b = RBIGINT(x);
|
||||||
|
mpz_t *m = &b->mp;
|
||||||
|
uint64_t u = 0;
|
||||||
|
size_t len = digits(m);
|
||||||
|
|
||||||
|
if (m->sn < 0 || len*sizeof(mp_limb) > sizeof(uint64_t)) {
|
||||||
|
mrb_raise(mrb, E_RANGE_ERROR, "integer out of range");
|
||||||
|
}
|
||||||
|
for (size_t i=len-1; ; i--) {
|
||||||
|
u <<= DIG_SIZE;
|
||||||
|
u |= m->p[i];
|
||||||
|
if (i==0) break;
|
||||||
|
}
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unnormalize version of mrb_bint_add */
|
||||||
|
mrb_value
|
||||||
|
mrb_bint_add_d(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||||
|
{
|
||||||
|
y = mrb_as_bint(mrb, y);
|
||||||
|
struct RBigint *b = RBIGINT(x);
|
||||||
|
struct RBigint *b2 = RBIGINT(y);
|
||||||
|
struct RBigint *b3 = bint_new(mrb);
|
||||||
|
mpz_add(mrb, &b3->mp, &b->mp, &b2->mp);
|
||||||
|
return mrb_obj_value(b3);
|
||||||
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
mrb_bint_add(mrb_state *mrb, mrb_value x, mrb_value y)
|
mrb_bint_add(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||||
{
|
{
|
||||||
@@ -1096,12 +1231,20 @@ mrb_bint_add(mrb_state *mrb, mrb_value x, mrb_value y)
|
|||||||
return mrb_float_value(mrb,v1+v2);
|
return mrb_float_value(mrb,v1+v2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
x = mrb_bint_add_d(mrb, x, y);
|
||||||
|
return bint_norm(mrb, RBIGINT(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unnormalize version of mrb_bint_sub */
|
||||||
|
mrb_value
|
||||||
|
mrb_bint_sub_d(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||||
|
{
|
||||||
y = mrb_as_bint(mrb, y);
|
y = mrb_as_bint(mrb, y);
|
||||||
struct RBigint *b = RBIGINT(x);
|
struct RBigint *b = RBIGINT(x);
|
||||||
struct RBigint *b2 = RBIGINT(y);
|
struct RBigint *b2 = RBIGINT(y);
|
||||||
struct RBigint *b3 = bint_new(mrb);
|
struct RBigint *b3 = bint_new(mrb);
|
||||||
mpz_add(mrb, &b3->mp, &b->mp, &b2->mp);
|
mpz_sub(mrb, &b3->mp, &b->mp, &b2->mp);
|
||||||
return bint_norm(mrb, b3);
|
return mrb_obj_value(b3);
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
@@ -1114,12 +1257,8 @@ mrb_bint_sub(mrb_state *mrb, mrb_value x, mrb_value y)
|
|||||||
return mrb_float_value(mrb,v1-v2);
|
return mrb_float_value(mrb,v1-v2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
y = mrb_as_bint(mrb, y);
|
x = mrb_bint_sub_d(mrb, x, y);
|
||||||
struct RBigint *b = RBIGINT(x);
|
return bint_norm(mrb, RBIGINT(x));
|
||||||
struct RBigint *b2 = RBIGINT(y);
|
|
||||||
struct RBigint *b3 = bint_new(mrb);
|
|
||||||
mpz_sub(mrb, &b3->mp, &b->mp, &b2->mp);
|
|
||||||
return bint_norm(mrb, b3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
@@ -1206,20 +1345,6 @@ mrb_bint_mul_ii(mrb_state *mrb, mrb_int x, mrb_int y)
|
|||||||
return bint_norm(mrb, b);
|
return bint_norm(mrb, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
|
||||||
mrb_bint_div_ii(mrb_state *mrb, mrb_int x, mrb_int y)
|
|
||||||
{
|
|
||||||
struct RBigint *b = bint_new(mrb);
|
|
||||||
mpz_t z1, z2;
|
|
||||||
|
|
||||||
mpz_init_set_int(mrb, &z1, x);
|
|
||||||
mpz_init_set_int(mrb, &z2, y);
|
|
||||||
mpz_mdiv(mrb, &b->mp, &z1, &z2);
|
|
||||||
mpz_clear(mrb, &z1);
|
|
||||||
mpz_clear(mrb, &z2);
|
|
||||||
return bint_norm(mrb, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
mrb_bint_mod(mrb_state *mrb, mrb_value x, mrb_value y)
|
mrb_bint_mod(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||||
{
|
{
|
||||||
@@ -1334,32 +1459,36 @@ mrb_bint_pow(mrb_state *mrb, mrb_value x, mrb_value y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
mrb_bint_powm(mrb_state *mrb, mrb_value x, mrb_int exp, mrb_value mod)
|
mrb_bint_powm(mrb_state *mrb, mrb_value x, mrb_value exp, mrb_value mod)
|
||||||
{
|
{
|
||||||
struct RBigint *b = RBIGINT(x);
|
struct RBigint *b = RBIGINT(x);
|
||||||
switch (mrb_type(mod)) {
|
struct RBigint *b2, *b3;
|
||||||
case MRB_TT_INTEGER:
|
|
||||||
{
|
if (mrb_bigint_p(mod)) {
|
||||||
mrb_int m = mrb_integer(mod);
|
b2 = RBIGINT(mod);
|
||||||
if (m == 0) mrb_int_zerodiv(mrb);
|
if (uzero(&b2->mp)) mrb_int_zerodiv(mrb);
|
||||||
struct RBigint *b2 = bint_new_int(mrb, m);
|
|
||||||
struct RBigint *b3 = bint_new(mrb);
|
|
||||||
mpz_powm(mrb, &b3->mp, &b->mp, exp, &b2->mp);
|
|
||||||
return bint_norm(mrb, b3);
|
|
||||||
}
|
|
||||||
case MRB_TT_BIGINT:
|
|
||||||
{
|
|
||||||
struct RBigint *b2 = RBIGINT(mod);
|
|
||||||
struct RBigint *b3 = bint_new(mrb);
|
|
||||||
if (uzero(&b2->mp)) mrb_int_zerodiv(mrb);
|
|
||||||
mpz_powm(mrb, &b3->mp, &b->mp, exp, &b2->mp);
|
|
||||||
return bint_norm(mrb, b3);
|
|
||||||
}
|
|
||||||
mrb_raise(mrb, E_TYPE_ERROR, "too big power");
|
|
||||||
default:
|
|
||||||
mrb_raisef(mrb, E_TYPE_ERROR, "%v cannot be convert to integer", mod);
|
|
||||||
}
|
}
|
||||||
return mrb_nil_value();
|
else {
|
||||||
|
mrb_int m = mrb_integer(mod);
|
||||||
|
if (m == 0) mrb_int_zerodiv(mrb);
|
||||||
|
b2 = bint_new_int(mrb, m);
|
||||||
|
}
|
||||||
|
b3 = bint_new(mrb);
|
||||||
|
if (mrb_bigint_p(exp)) {
|
||||||
|
struct RBigint *be = RBIGINT(exp);
|
||||||
|
if (be->mp.sn < 0) {
|
||||||
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "int.pow(n,m): n must be positive");
|
||||||
|
}
|
||||||
|
mpz_powm(mrb, &b3->mp, &b->mp, &be->mp, &b2->mp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mrb_int e = mrb_integer(exp);
|
||||||
|
if (e < 0) {
|
||||||
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "int.pow(n,m): n must be positive");
|
||||||
|
}
|
||||||
|
mpz_powm_i(mrb, &b3->mp, &b->mp, e, &b2->mp);
|
||||||
|
}
|
||||||
|
return bint_norm(mrb, b3);
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
|
|||||||
@@ -11,7 +11,16 @@ MRuby::Gem::Specification.new('mruby-bin-config') do |spec|
|
|||||||
else
|
else
|
||||||
mruby_config_dir = "#{build.build_dir}/bin"
|
mruby_config_dir = "#{build.build_dir}/bin"
|
||||||
end
|
end
|
||||||
mruby_config = name + (ENV['OS'] == 'Windows_NT' ? '.bat' : '')
|
|
||||||
|
if ENV['OS'] == 'Windows_NT'
|
||||||
|
suffix = '.bat'
|
||||||
|
refvar = '%\\1%'
|
||||||
|
else
|
||||||
|
suffix = ''
|
||||||
|
refvar = '${\\1}'
|
||||||
|
end
|
||||||
|
|
||||||
|
mruby_config = name + suffix
|
||||||
mruby_config_path = "#{mruby_config_dir}/#{mruby_config}"
|
mruby_config_path = "#{mruby_config_dir}/#{mruby_config}"
|
||||||
make_cfg = "#{build.build_dir}/lib/libmruby.flags.mak"
|
make_cfg = "#{build.build_dir}/lib/libmruby.flags.mak"
|
||||||
tmplt_path = "#{__dir__}/#{mruby_config}"
|
tmplt_path = "#{__dir__}/#{mruby_config}"
|
||||||
@@ -24,11 +33,16 @@ MRuby::Gem::Specification.new('mruby-bin-config') do |spec|
|
|||||||
|
|
||||||
directory mruby_config_dir
|
directory mruby_config_dir
|
||||||
|
|
||||||
file mruby_config_path => [mruby_config_dir, make_cfg, tmplt_path] do |t|
|
file mruby_config_path => [__FILE__, mruby_config_dir, make_cfg, tmplt_path] do |t|
|
||||||
config = Hash[File.readlines(make_cfg).map!(&:chomp).map! {|l|
|
config = Hash[File.readlines(make_cfg).map!(&:chomp).map! {|l|
|
||||||
|
l.gsub!(/\$\((\w+)\)/, refvar)
|
||||||
l.gsub('\\"', '"').split(' = ', 2).map! {|s| s.sub(/^(?=.)/, 'echo ')}
|
l.gsub('\\"', '"').split(' = ', 2).map! {|s| s.sub(/^(?=.)/, 'echo ')}
|
||||||
}]
|
}]
|
||||||
tmplt = File.read(tmplt_path)
|
tmplt = File.read(tmplt_path)
|
||||||
|
tmplt.sub!(%r((?<=\A#!/bin/sh\n\n)), <<~SETDIR)
|
||||||
|
MRUBY_PACKAGE_DIR=$(dirname "$(dirname "$(readlink -f "$0")")")
|
||||||
|
|
||||||
|
SETDIR
|
||||||
File.write(t.name, tmplt.gsub(/(#{Regexp.union(*config.keys)})\b/, config))
|
File.write(t.name, tmplt.gsub(/(#{Regexp.union(*config.keys)})\b/, config))
|
||||||
chmod(0755, t.name)
|
chmod(0755, t.name)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,8 +4,14 @@ print_help()
|
|||||||
{
|
{
|
||||||
echo "Usage: mruby-config [switches]"
|
echo "Usage: mruby-config [switches]"
|
||||||
echo " switches:"
|
echo " switches:"
|
||||||
echo " --cc print compiler name"
|
echo " --cc print C compiler name"
|
||||||
echo " --cflags print flags passed to compiler"
|
echo " --cflags print flags passed to C compiler"
|
||||||
|
echo " --cxx print C++ compiler name"
|
||||||
|
echo " --cxxflags print flags passed to C++ compiler"
|
||||||
|
echo " --as print assembler name"
|
||||||
|
echo " --asflags print flags passed to assembler"
|
||||||
|
echo " --objc print Objective C compiler name"
|
||||||
|
echo " --objcflags print flags passed to Objective C compiler"
|
||||||
echo " --ld print linker name"
|
echo " --ld print linker name"
|
||||||
echo " --ldflags print flags passed to linker"
|
echo " --ldflags print flags passed to linker"
|
||||||
echo " --ldflags-before-libs print flags passed to linker before linked libraries"
|
echo " --ldflags-before-libs print flags passed to linker before linked libraries"
|
||||||
@@ -23,6 +29,12 @@ while [ $# -gt 0 ]; do
|
|||||||
case $1 in
|
case $1 in
|
||||||
--cc) echo MRUBY_CC;;
|
--cc) echo MRUBY_CC;;
|
||||||
--cflags) echo MRUBY_CFLAGS;;
|
--cflags) echo MRUBY_CFLAGS;;
|
||||||
|
--cxx) echo MRUBY_CXX;;
|
||||||
|
--cxxflags) echo MRUBY_CXXFLAGS;;
|
||||||
|
--as) echo MRUBY_AS;;
|
||||||
|
--asflags) echo MRUBY_ASFLAGS;;
|
||||||
|
--objc) echo MRUBY_OBJC;;
|
||||||
|
--objcflags) echo MRUBY_OBJCFLAGS;;
|
||||||
--ld) echo MRUBY_LD;;
|
--ld) echo MRUBY_LD;;
|
||||||
--ldflags) echo MRUBY_LDFLAGS;;
|
--ldflags) echo MRUBY_LDFLAGS;;
|
||||||
--ldflags-before-libs) echo MRUBY_LDFLAGS_BEFORE_LIBS;;
|
--ldflags-before-libs) echo MRUBY_LDFLAGS_BEFORE_LIBS;;
|
||||||
|
|||||||
@@ -1,10 +1,28 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
call :init "%~dp0."
|
||||||
|
goto top
|
||||||
|
|
||||||
|
:init
|
||||||
|
rem call init2 for treatments last directory separator
|
||||||
|
call :init2 "%~dp1."
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:init2
|
||||||
|
set MRUBY_PACKAGE_DIR=%~f1
|
||||||
|
goto :eof
|
||||||
|
|
||||||
:top
|
:top
|
||||||
shift
|
shift
|
||||||
if "%0" equ "" goto :eof
|
if "%0" equ "" goto :eof
|
||||||
if "%0" equ "--cc" goto cc
|
if "%0" equ "--cc" goto cc
|
||||||
if "%0" equ "--cflags" goto cflags
|
if "%0" equ "--cflags" goto cflags
|
||||||
|
if "%0" equ "--cxx" goto cxx
|
||||||
|
if "%0" equ "--cxxflags" goto cxxflags
|
||||||
|
if "%0" equ "--as" goto as
|
||||||
|
if "%0" equ "--asflags" goto asflags
|
||||||
|
if "%0" equ "--objc" goto objc
|
||||||
|
if "%0" equ "--objcflags" goto objcflags
|
||||||
if "%0" equ "--ld" goto ld
|
if "%0" equ "--ld" goto ld
|
||||||
if "%0" equ "--ldflags" goto ldflags
|
if "%0" equ "--ldflags" goto ldflags
|
||||||
if "%0" equ "--ldflags-before-libs" goto ldflagsbeforelibs
|
if "%0" equ "--ldflags-before-libs" goto ldflagsbeforelibs
|
||||||
@@ -22,6 +40,30 @@ goto top
|
|||||||
echo MRUBY_CFLAGS
|
echo MRUBY_CFLAGS
|
||||||
goto top
|
goto top
|
||||||
|
|
||||||
|
:cxx
|
||||||
|
echo MRUBY_CXX
|
||||||
|
goto top
|
||||||
|
|
||||||
|
:cxxflags
|
||||||
|
echo MRUBY_CXXFLAGS
|
||||||
|
goto top
|
||||||
|
|
||||||
|
:as
|
||||||
|
echo MRUBY_AS
|
||||||
|
goto top
|
||||||
|
|
||||||
|
:asflags
|
||||||
|
echo MRUBY_ASFLAGS
|
||||||
|
goto top
|
||||||
|
|
||||||
|
:objc
|
||||||
|
echo MRUBY_OBJC
|
||||||
|
goto top
|
||||||
|
|
||||||
|
:objcflags
|
||||||
|
echo MRUBY_OBJCFLAGS
|
||||||
|
goto top
|
||||||
|
|
||||||
:ld
|
:ld
|
||||||
echo MRUBY_LD
|
echo MRUBY_LD
|
||||||
goto top
|
goto top
|
||||||
@@ -45,8 +87,14 @@ goto top
|
|||||||
:showhelp
|
:showhelp
|
||||||
echo Usage: mruby-config [switches]
|
echo Usage: mruby-config [switches]
|
||||||
echo switches:
|
echo switches:
|
||||||
echo --cc print compiler name
|
echo --cc print C compiler name
|
||||||
echo --cflags print flags passed to compiler
|
echo --cflags print flags passed to C compiler
|
||||||
|
echo --cxx print C++ compiler name
|
||||||
|
echo --cxxflags print flags passed to C++ compiler
|
||||||
|
echo --as print assembler name
|
||||||
|
echo --asflags print flags passed to assembler
|
||||||
|
echo --objc print Objective C compiler name
|
||||||
|
echo --objcflags print flags passed to Objective C compiler
|
||||||
echo --ld print linker name
|
echo --ld print linker name
|
||||||
echo --ldflags print flags passed to linker
|
echo --ldflags print flags passed to linker
|
||||||
echo --ldflags-before-libs print flags passed to linker before linked libraries
|
echo --ldflags-before-libs print flags passed to linker before linked libraries
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ MRuby::Gem::Specification.new('mruby-bin-debugger') do |spec|
|
|||||||
spec.license = 'MIT'
|
spec.license = 'MIT'
|
||||||
spec.author = 'mruby developers'
|
spec.author = 'mruby developers'
|
||||||
spec.summary = 'mruby debugger command'
|
spec.summary = 'mruby debugger command'
|
||||||
spec.build.defines |= %w(MRB_USE_DEBUG_HOOK)
|
spec.build.defines << "MRB_USE_DEBUG_HOOK"
|
||||||
spec.add_dependency('mruby-eval', :core => 'mruby-eval')
|
spec.add_dependency('mruby-eval', :core => 'mruby-eval')
|
||||||
|
|
||||||
spec.bins = %w(mrdb)
|
spec.bins = %w(mrdb)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ get_break_index(mrb_debug_context *dbg, uint32_t bpno)
|
|||||||
int32_t index;
|
int32_t index;
|
||||||
char hit = FALSE;
|
char hit = FALSE;
|
||||||
|
|
||||||
for(i = 0 ; i < dbg->bpnum; i++) {
|
for (i = 0; i < dbg->bpnum; i++) {
|
||||||
if (dbg->bp[i].bpno == bpno) {
|
if (dbg->bp[i].bpno == bpno) {
|
||||||
hit = TRUE;
|
hit = TRUE;
|
||||||
index = i;
|
index = i;
|
||||||
@@ -341,7 +341,7 @@ mrb_debug_delete_break(mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno)
|
|||||||
|
|
||||||
free_breakpoint(mrb, &dbg->bp[index]);
|
free_breakpoint(mrb, &dbg->bp[index]);
|
||||||
|
|
||||||
for(i = index ; i < dbg->bpnum; i++) {
|
for (i = index; i < dbg->bpnum; i++) {
|
||||||
if ((i + 1) == dbg->bpnum) {
|
if ((i + 1) == dbg->bpnum) {
|
||||||
dbg->bp[i] = (mrb_debug_breakpoint){0};
|
dbg->bp[i] = (mrb_debug_breakpoint){0};
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ mrb_debug_delete_break_all(mrb_state *mrb, mrb_debug_context *dbg)
|
|||||||
return MRB_DEBUG_INVALID_ARGUMENT;
|
return MRB_DEBUG_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0 ; i < dbg->bpnum ; i++) {
|
for (i = 0; i < dbg->bpnum; i++) {
|
||||||
free_breakpoint(mrb, &dbg->bp[i]);
|
free_breakpoint(mrb, &dbg->bp[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ mrb_debug_enable_break_all(mrb_state *mrb, mrb_debug_context *dbg)
|
|||||||
return MRB_DEBUG_INVALID_ARGUMENT;
|
return MRB_DEBUG_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0 ; i < dbg->bpnum; i++) {
|
for (i = 0; i < dbg->bpnum; i++) {
|
||||||
dbg->bp[i].enable = TRUE;
|
dbg->bp[i].enable = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +436,7 @@ mrb_debug_disable_break_all(mrb_state *mrb, mrb_debug_context *dbg)
|
|||||||
return MRB_DEBUG_INVALID_ARGUMENT;
|
return MRB_DEBUG_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0 ; i < dbg->bpnum; i++) {
|
for (i = 0; i < dbg->bpnum; i++) {
|
||||||
dbg->bp[i].enable = FALSE;
|
dbg->bp[i].enable = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ mrb_debug_check_breakpoint_line(mrb_state *mrb, mrb_debug_context *dbg, const ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
bp = dbg->bp;
|
bp = dbg->bp;
|
||||||
for(i=0; i<dbg->bpnum; i++) {
|
for (i=0; i<dbg->bpnum; i++) {
|
||||||
switch (bp->type) {
|
switch (bp->type) {
|
||||||
case MRB_DEBUG_BPTYPE_LINE:
|
case MRB_DEBUG_BPTYPE_LINE:
|
||||||
if (bp->enable == TRUE) {
|
if (bp->enable == TRUE) {
|
||||||
@@ -504,7 +504,7 @@ mrb_debug_check_breakpoint_method(mrb_state *mrb, mrb_debug_context *dbg, struct
|
|||||||
}
|
}
|
||||||
|
|
||||||
bp = dbg->bp;
|
bp = dbg->bp;
|
||||||
for(i=0; i<dbg->bpnum; i++) {
|
for (i=0; i<dbg->bpnum; i++) {
|
||||||
if (bp->type == MRB_DEBUG_BPTYPE_METHOD) {
|
if (bp->type == MRB_DEBUG_BPTYPE_METHOD) {
|
||||||
if (bp->enable == TRUE) {
|
if (bp->enable == TRUE) {
|
||||||
bpno = compare_break_method(mrb, bp, class_obj, method_sym, isCfunc);
|
bpno = compare_break_method(mrb, bp, class_obj, method_sym, isCfunc);
|
||||||
|
|||||||
@@ -9,18 +9,18 @@
|
|||||||
#include <mruby.h>
|
#include <mruby.h>
|
||||||
#include "mrdb.h"
|
#include "mrdb.h"
|
||||||
|
|
||||||
int32_t mrb_debug_set_break_line(mrb_state *, mrb_debug_context *, const char *, uint16_t);
|
int32_t mrb_debug_set_break_line(mrb_state*, mrb_debug_context*, const char*, uint16_t);
|
||||||
int32_t mrb_debug_set_break_method(mrb_state *, mrb_debug_context *, const char *, const char *);
|
int32_t mrb_debug_set_break_method(mrb_state*, mrb_debug_context*, const char*, const char*);
|
||||||
int32_t mrb_debug_get_breaknum(mrb_state *, mrb_debug_context *);
|
int32_t mrb_debug_get_breaknum(mrb_state*, mrb_debug_context*);
|
||||||
int32_t mrb_debug_get_break_all(mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint bp[]);
|
int32_t mrb_debug_get_break_all(mrb_state*, mrb_debug_context*, uint32_t, mrb_debug_breakpoint bp[]);
|
||||||
int32_t mrb_debug_get_break(mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint *);
|
int32_t mrb_debug_get_break(mrb_state*, mrb_debug_context*, uint32_t, mrb_debug_breakpoint*);
|
||||||
int32_t mrb_debug_delete_break(mrb_state *, mrb_debug_context *, uint32_t);
|
int32_t mrb_debug_delete_break(mrb_state*, mrb_debug_context*, uint32_t);
|
||||||
int32_t mrb_debug_delete_break_all(mrb_state *, mrb_debug_context *);
|
int32_t mrb_debug_delete_break_all(mrb_state*, mrb_debug_context*);
|
||||||
int32_t mrb_debug_enable_break(mrb_state *, mrb_debug_context *, uint32_t);
|
int32_t mrb_debug_enable_break(mrb_state*, mrb_debug_context*, uint32_t);
|
||||||
int32_t mrb_debug_enable_break_all(mrb_state *, mrb_debug_context *);
|
int32_t mrb_debug_enable_break_all(mrb_state*, mrb_debug_context*);
|
||||||
int32_t mrb_debug_disable_break(mrb_state *, mrb_debug_context *, uint32_t);
|
int32_t mrb_debug_disable_break(mrb_state*, mrb_debug_context*, uint32_t);
|
||||||
int32_t mrb_debug_disable_break_all(mrb_state *, mrb_debug_context *);
|
int32_t mrb_debug_disable_break_all(mrb_state*, mrb_debug_context*);
|
||||||
int32_t mrb_debug_check_breakpoint_line(mrb_state *, mrb_debug_context *, const char *, uint16_t);
|
int32_t mrb_debug_check_breakpoint_line(mrb_state*, mrb_debug_context*, const char*, uint16_t);
|
||||||
int32_t mrb_debug_check_breakpoint_method(mrb_state *, mrb_debug_context *, struct RClass *, mrb_sym, mrb_bool*);
|
int32_t mrb_debug_check_breakpoint_method(mrb_state*, mrb_debug_context*, struct RClass*, mrb_sym, mrb_bool*);
|
||||||
|
|
||||||
#endif /* APIBREAK_H_ */
|
#endif /* APIBREAK_H_ */
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ mrb_debug_get_source(mrb_state *mrb, mrdb_state *mrdb, const char *srcpath, cons
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_free(mrb, (void *)search_path[1]);
|
mrb_free(mrb, (void*)search_path[1]);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <mruby.h>
|
#include <mruby.h>
|
||||||
#include "mrdb.h"
|
#include "mrdb.h"
|
||||||
|
|
||||||
int32_t mrb_debug_list(mrb_state *, mrb_debug_context *, char *, uint16_t, uint16_t);
|
int32_t mrb_debug_list(mrb_state*, mrb_debug_context*, char*, uint16_t, uint16_t);
|
||||||
char* mrb_debug_get_source(mrb_state *, mrdb_state *, const char *, const char *);
|
char* mrb_debug_get_source(mrb_state*, mrdb_state*, const char*, const char *);
|
||||||
|
|
||||||
#endif /* APILIST_H_ */
|
#endif /* APILIST_H_ */
|
||||||
|
|||||||
@@ -17,24 +17,24 @@
|
|||||||
static void
|
static void
|
||||||
mrdb_check_syntax(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size_t len)
|
mrdb_check_syntax(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size_t len)
|
||||||
{
|
{
|
||||||
mrbc_context *c;
|
mrb_ccontext *c;
|
||||||
|
|
||||||
c = mrbc_context_new(mrb);
|
c = mrb_ccontext_new(mrb);
|
||||||
c->no_exec = TRUE;
|
c->no_exec = TRUE;
|
||||||
c->capture_errors = TRUE;
|
c->capture_errors = TRUE;
|
||||||
mrbc_filename(mrb, c, (const char*)dbg->prvfile);
|
mrb_ccontext_filename(mrb, c, (const char*)dbg->prvfile);
|
||||||
c->lineno = dbg->prvline;
|
c->lineno = dbg->prvline;
|
||||||
|
|
||||||
/* Load program */
|
/* Load program */
|
||||||
mrb_load_nstring_cxt(mrb, expr, len, c);
|
mrb_load_nstring_cxt(mrb, expr, len, c);
|
||||||
|
|
||||||
mrbc_context_free(mrb, c);
|
mrb_ccontext_free(mrb, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
mrb_value
|
mrb_value
|
||||||
mrb_debug_eval(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size_t len, mrb_bool *exc, int direct_eval)
|
mrb_debug_eval(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size_t len, mrb_bool *exc, int direct_eval)
|
||||||
{
|
{
|
||||||
void (*tmp)(struct mrb_state *, const struct mrb_irep *, const mrb_code *, mrb_value *);
|
void (*tmp)(struct mrb_state*, const struct mrb_irep*, const mrb_code*, mrb_value*);
|
||||||
mrb_value ruby_code;
|
mrb_value ruby_code;
|
||||||
mrb_value s;
|
mrb_value s;
|
||||||
mrb_value v;
|
mrb_value v;
|
||||||
@@ -68,11 +68,11 @@ mrb_debug_eval(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size_t
|
|||||||
|
|
||||||
recv = dbg->regs[0];
|
recv = dbg->regs[0];
|
||||||
|
|
||||||
v = mrb_funcall_id(mrb, recv, MRB_SYM(instance_eval), 1, ruby_code);
|
v = mrb_funcall_argv(mrb, recv, MRB_SYM(instance_eval), 1, &ruby_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exc) {
|
if (exc) {
|
||||||
*exc = mrb_obj_is_kind_of(mrb, v, mrb->eException_class);
|
*exc = mrb_obj_is_kind_of(mrb, v, E_EXCEPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
s = mrb_inspect(mrb, v);
|
s = mrb_inspect(mrb, v);
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
#define LINENO_MAX_DIGIT 6
|
#define LINENO_MAX_DIGIT 6
|
||||||
#define BPNO_LETTER_NUM 9
|
#define BPNO_LETTER_NUM 9
|
||||||
|
|
||||||
typedef int32_t (*all_command_func)(mrb_state *, mrb_debug_context *);
|
typedef int32_t (*all_command_func)(mrb_state*, mrb_debug_context*);
|
||||||
typedef int32_t (*select_command_func)(mrb_state *, mrb_debug_context *, uint32_t);
|
typedef int32_t (*select_command_func)(mrb_state*, mrb_debug_context*, uint32_t);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_api_common_error(int32_t error)
|
print_api_common_error(int32_t error)
|
||||||
@@ -61,7 +61,7 @@ print_api_common_error(int32_t error)
|
|||||||
#define STRTOUL(ul,s) { \
|
#define STRTOUL(ul,s) { \
|
||||||
int i; \
|
int i; \
|
||||||
ul = 0; \
|
ul = 0; \
|
||||||
for(i=0; ISDIGIT(s[i]); i++) ul = 10*ul + (s[i] -'0'); \
|
for (i=0; ISDIGIT(s[i]); i++) ul = 10*ul + (s[i] -'0'); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t
|
static int32_t
|
||||||
@@ -106,7 +106,7 @@ exe_set_command_select(mrb_state *mrb, mrdb_state *mrdb, select_command_func fun
|
|||||||
int32_t bpno = 0;
|
int32_t bpno = 0;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
for(i=1; i<mrdb->wcnt; i++) {
|
for (i=1; i<mrdb->wcnt; i++) {
|
||||||
ps = mrdb->words[i];
|
ps = mrdb->words[i];
|
||||||
bpno = parse_breakpoint_no(ps);
|
bpno = parse_breakpoint_no(ps);
|
||||||
if (bpno == 0) {
|
if (bpno == 0) {
|
||||||
@@ -199,7 +199,7 @@ info_break_all(mrb_state *mrb, mrdb_state *mrdb)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
puts(BREAK_INFO_MSG_HEADER);
|
puts(BREAK_INFO_MSG_HEADER);
|
||||||
for(i = 0 ; i < bpnum ; i++) {
|
for (i = 0; i < bpnum; i++) {
|
||||||
print_breakpoint(&bp_list[i]);
|
print_breakpoint(&bp_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ info_break_select(mrb_state *mrb, mrdb_state *mrdb)
|
|||||||
mrb_bool isFirst = TRUE;
|
mrb_bool isFirst = TRUE;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
for(i=2; i<mrdb->wcnt; i++) {
|
for (i=2; i<mrdb->wcnt; i++) {
|
||||||
ps = mrdb->words[i];
|
ps = mrdb->words[i];
|
||||||
bpno = parse_breakpoint_no(ps);
|
bpno = parse_breakpoint_no(ps);
|
||||||
if (bpno == 0) {
|
if (bpno == 0) {
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ parse_uint(char **sp, uint16_t *n)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = *sp; *p != '\0' && ISDIGIT(*p); p++) ;
|
for (p = *sp; *p != '\0' && ISDIGIT(*p); p++)
|
||||||
|
;
|
||||||
|
|
||||||
if (p != *sp && (i = atoi(*sp)) >= 0) {
|
if (p != *sp && (i = atoi(*sp)) >= 0) {
|
||||||
*n = (uint16_t)i;
|
*n = (uint16_t)i;
|
||||||
@@ -350,9 +351,9 @@ check_cmd_pattern(const char *pattern, const char *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = lbracket + 1;
|
p = lbracket + 1;
|
||||||
q = (char *)cmd + (lbracket - pattern);
|
q = (char*)cmd + (lbracket - pattern);
|
||||||
|
|
||||||
for ( ; p < rbracket && *q != '\0'; p++, q++) {
|
for (; p < rbracket && *q != '\0'; p++, q++) {
|
||||||
if (*p != *q) {
|
if (*p != *q) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -479,7 +480,8 @@ dbgcmd_quit(mrb_state *mrb, mrdb_state *mrdb)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
c = buf;
|
c = buf;
|
||||||
while (buf != '\n' && (buf = getchar()) != EOF) ;
|
while (buf != '\n' && (buf = getchar()) != EOF)
|
||||||
|
;
|
||||||
|
|
||||||
if (c == 'y' || c == 'Y') {
|
if (c == 'y' || c == 'Y') {
|
||||||
mrdb->dbg->xm = DBG_QUIT;
|
mrdb->dbg->xm = DBG_QUIT;
|
||||||
@@ -500,7 +502,7 @@ dbgcmd_quit(mrb_state *mrb, mrdb_state *mrdb)
|
|||||||
|
|
||||||
if (mrdb->dbg->xm == DBG_QUIT) {
|
if (mrdb->dbg->xm == DBG_QUIT) {
|
||||||
struct RClass *exc;
|
struct RClass *exc;
|
||||||
exc = mrb_define_class(mrb, "DebuggerExit", mrb->eException_class);
|
exc = mrb_define_class(mrb, "DebuggerExit", E_EXCEPTION);
|
||||||
mrb_raise(mrb, exc, "Exit mrdb");
|
mrb_raise(mrb, exc, "Exit mrdb");
|
||||||
}
|
}
|
||||||
return DBGST_PROMPT;
|
return DBGST_PROMPT;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ dbgcmd_run(mrb_state *mrb, mrdb_state *mrdb)
|
|||||||
if (dbg->xphase == DBG_PHASE_RUNNING){
|
if (dbg->xphase == DBG_PHASE_RUNNING){
|
||||||
struct RClass *exc;
|
struct RClass *exc;
|
||||||
puts("Start it from the beginning");
|
puts("Start it from the beginning");
|
||||||
exc = mrb_define_class(mrb, "DebuggerRestart", mrb->eException_class);
|
exc = mrb_define_class(mrb, "DebuggerRestart", E_EXCEPTION);
|
||||||
mrb_raise(mrb, exc, "Restart mrdb");
|
mrb_raise(mrb, exc, "Restart mrdb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "apibreak.h"
|
#include "apibreak.h"
|
||||||
#include "apilist.h"
|
#include "apilist.h"
|
||||||
|
|
||||||
void mrdb_state_free(mrb_state *);
|
void mrdb_state_free(mrb_state*);
|
||||||
|
|
||||||
static mrb_debug_context *_debug_context = NULL;
|
static mrb_debug_context *_debug_context = NULL;
|
||||||
static mrdb_state *_mrdb_state = NULL;
|
static mrdb_state *_mrdb_state = NULL;
|
||||||
@@ -113,7 +113,7 @@ append_srcpath:
|
|||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buflen = strlen(item) + 1;
|
buflen = strlen(item) + 1;
|
||||||
buf = (char *)mrb_malloc(mrb, buflen);
|
buf = (char*)mrb_malloc(mrb, buflen);
|
||||||
memcpy(buf, item, buflen);
|
memcpy(buf, item, buflen);
|
||||||
args->srcpath = buf;
|
args->srcpath = buf;
|
||||||
}
|
}
|
||||||
@@ -123,8 +123,7 @@ append_srcpath:
|
|||||||
|
|
||||||
srcpathlen = strlen(args->srcpath);
|
srcpathlen = strlen(args->srcpath);
|
||||||
itemlen = strlen(item);
|
itemlen = strlen(item);
|
||||||
args->srcpath =
|
args->srcpath = (char*)mrb_realloc(mrb, args->srcpath, srcpathlen + itemlen + 2);
|
||||||
(char *)mrb_realloc(mrb, args->srcpath, srcpathlen + itemlen + 2);
|
|
||||||
args->srcpath[srcpathlen] = '\n';
|
args->srcpath[srcpathlen] = '\n';
|
||||||
memcpy(args->srcpath + srcpathlen + 1, item, itemlen + 1);
|
memcpy(args->srcpath + srcpathlen + 1, item, itemlen + 1);
|
||||||
}
|
}
|
||||||
@@ -280,7 +279,7 @@ get_command(mrb_state *mrb, mrdb_state *mrdb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == MAX_COMMAND_LINE) {
|
if (i == MAX_COMMAND_LINE) {
|
||||||
for ( ; (c=getchar()) != EOF && c !='\n'; i++) ;
|
for (; (c=getchar()) != EOF && c !='\n'; i++) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > MAX_COMMAND_LINE) {
|
if (i > MAX_COMMAND_LINE) {
|
||||||
@@ -297,7 +296,8 @@ pick_out_word(mrb_state *mrb, char **pp)
|
|||||||
{
|
{
|
||||||
char *ps;
|
char *ps;
|
||||||
|
|
||||||
for (ps=*pp; ISBLANK(*ps); ps++) ;
|
for (ps=*pp; ISBLANK(*ps); ps++)
|
||||||
|
;
|
||||||
if (*ps == '\0') {
|
if (*ps == '\0') {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,8 @@ parse_command(mrb_state *mrb, mrdb_state *mrdb, char *buf)
|
|||||||
}
|
}
|
||||||
mrdb->wcnt = 1;
|
mrdb->wcnt = 1;
|
||||||
/* set remain parameter */
|
/* set remain parameter */
|
||||||
for ( ; *p && ISBLANK(*p); p++) ;
|
for (; *p && ISBLANK(*p); p++)
|
||||||
|
;
|
||||||
if (*p) {
|
if (*p) {
|
||||||
mrdb->words[mrdb->wcnt++] = p;
|
mrdb->words[mrdb->wcnt++] = p;
|
||||||
}
|
}
|
||||||
@@ -356,7 +357,8 @@ parse_command(mrb_state *mrb, mrdb_state *mrdb, char *buf)
|
|||||||
mrdb->words[1] = pick_out_word(mrb, &p);
|
mrdb->words[1] = pick_out_word(mrb, &p);
|
||||||
if (mrdb->words[1]) {
|
if (mrdb->words[1]) {
|
||||||
/* update remain parameter */
|
/* update remain parameter */
|
||||||
for ( ; *p && ISBLANK(*p); p++) ;
|
for (; *p && ISBLANK(*p); p++)
|
||||||
|
;
|
||||||
if (*p) {
|
if (*p) {
|
||||||
mrdb->words[mrdb->wcnt++] = p;
|
mrdb->words[mrdb->wcnt++] = p;
|
||||||
}
|
}
|
||||||
@@ -364,7 +366,7 @@ parse_command(mrb_state *mrb, mrdb_state *mrdb, char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check word #1,#2 */
|
/* check word #1,#2 */
|
||||||
for ( ; cmd->cmd1; cmd++) {
|
for (; cmd->cmd1; cmd++) {
|
||||||
wlen = strlen(mrdb->words[0]);
|
wlen = strlen(mrdb->words[0]);
|
||||||
if (wlen < cmd->len1 ||
|
if (wlen < cmd->len1 ||
|
||||||
strncmp(mrdb->words[0], cmd->cmd1, wlen)) {
|
strncmp(mrdb->words[0], cmd->cmd1, wlen)) {
|
||||||
@@ -386,7 +388,7 @@ parse_command(mrb_state *mrb, mrdb_state *mrdb, char *buf)
|
|||||||
/* divide remain parameters */
|
/* divide remain parameters */
|
||||||
if (cmd->cmd1 && cmd->div) {
|
if (cmd->cmd1 && cmd->div) {
|
||||||
p = mrdb->words[--mrdb->wcnt];
|
p = mrdb->words[--mrdb->wcnt];
|
||||||
for ( ; mrdb->wcnt<MAX_COMMAND_WORD; mrdb->wcnt++) {
|
for (; mrdb->wcnt<MAX_COMMAND_WORD; mrdb->wcnt++) {
|
||||||
mrdb->words[mrdb->wcnt] = pick_out_word(mrb, &p);
|
mrdb->words[mrdb->wcnt] = pick_out_word(mrb, &p);
|
||||||
if (!mrdb->words[mrdb->wcnt]) {
|
if (!mrdb->words[mrdb->wcnt]) {
|
||||||
break;
|
break;
|
||||||
@@ -704,10 +706,10 @@ main(int argc, char **argv)
|
|||||||
v = mrb_load_irep_file(mrb, args.rfp);
|
v = mrb_load_irep_file(mrb, args.rfp);
|
||||||
}
|
}
|
||||||
else { /* .rb */
|
else { /* .rb */
|
||||||
mrbc_context *cc = mrbc_context_new(mrb);
|
mrb_ccontext *cc = mrb_ccontext_new(mrb);
|
||||||
mrbc_filename(mrb, cc, args.fname);
|
mrb_ccontext_filename(mrb, cc, args.fname);
|
||||||
v = mrb_load_file_cxt(mrb, args.rfp, cc);
|
v = mrb_load_file_cxt(mrb, args.rfp, cc);
|
||||||
mrbc_context_free(mrb, cc);
|
mrb_ccontext_free(mrb, cc);
|
||||||
}
|
}
|
||||||
if (mrdb->dbg->xm == DBG_QUIT && !mrb_undef_p(v) && mrb->exc) {
|
if (mrdb->dbg->xm == DBG_QUIT && !mrb_undef_p(v) && mrb->exc) {
|
||||||
const char *classname = mrb_obj_classname(mrb, mrb_obj_value(mrb->exc));
|
const char *classname = mrb_obj_classname(mrb, mrb_obj_value(mrb->exc));
|
||||||
|
|||||||
@@ -74,10 +74,6 @@ typedef enum {
|
|||||||
MRB_DEBUG_BPTYPE_METHOD,
|
MRB_DEBUG_BPTYPE_METHOD,
|
||||||
} mrb_debug_bptype;
|
} mrb_debug_bptype;
|
||||||
|
|
||||||
struct mrb_irep;
|
|
||||||
struct mrbc_context;
|
|
||||||
struct mrb_debug_context;
|
|
||||||
|
|
||||||
typedef struct mrb_debug_linepoint {
|
typedef struct mrb_debug_linepoint {
|
||||||
const char *file;
|
const char *file;
|
||||||
uint16_t lineno;
|
uint16_t lineno;
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ get_history_path(mrb_state *mrb)
|
|||||||
int len = snprintf(NULL, 0, "%s/%s", home, history_file_name);
|
int len = snprintf(NULL, 0, "%s/%s", home, history_file_name);
|
||||||
if (len >= 0) {
|
if (len >= 0) {
|
||||||
size_t size = len + 1;
|
size_t size = len + 1;
|
||||||
path = (char *)mrb_malloc_simple(mrb, size);
|
path = (char*)mrb_malloc_simple(mrb, size);
|
||||||
if (path != NULL) {
|
if (path != NULL) {
|
||||||
int n = snprintf(path, size, "%s/%s", home, history_file_name);
|
int n = snprintf(path, size, "%s/%s", home, history_file_name);
|
||||||
if (n != len) {
|
if (n != len) {
|
||||||
@@ -117,7 +117,7 @@ p(mrb_state *mrb, mrb_value obj, int prompt)
|
|||||||
mrb_value val;
|
mrb_value val;
|
||||||
char* msg;
|
char* msg;
|
||||||
|
|
||||||
val = mrb_funcall_id(mrb, obj, MRB_SYM(inspect), 0);
|
val = mrb_funcall_argv(mrb, obj, MRB_SYM(inspect), 0, NULL);
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
if (!mrb->exc) {
|
if (!mrb->exc) {
|
||||||
fputs(" => ", stdout);
|
fputs(" => ", stdout);
|
||||||
@@ -422,7 +422,7 @@ ctrl_c_handler(int signo)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MRB_NO_MIRB_UNDERSCORE
|
#ifndef MRB_NO_MIRB_UNDERSCORE
|
||||||
void decl_lv_underscore(mrb_state *mrb, mrbc_context *cxt)
|
void decl_lv_underscore(mrb_state *mrb, mrb_ccontext *cxt)
|
||||||
{
|
{
|
||||||
struct RProc *proc;
|
struct RProc *proc;
|
||||||
struct mrb_parser_state *parser;
|
struct mrb_parser_state *parser;
|
||||||
@@ -453,7 +453,7 @@ main(int argc, char **argv)
|
|||||||
char *history_path;
|
char *history_path;
|
||||||
char* line;
|
char* line;
|
||||||
#endif
|
#endif
|
||||||
mrbc_context *cxt;
|
mrb_ccontext *cxt;
|
||||||
struct mrb_parser_state *parser;
|
struct mrb_parser_state *parser;
|
||||||
mrb_state *mrb;
|
mrb_state *mrb;
|
||||||
mrb_value result;
|
mrb_value result;
|
||||||
@@ -504,11 +504,10 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
print_hint();
|
print_hint();
|
||||||
|
|
||||||
cxt = mrbc_context_new(mrb);
|
cxt = mrb_ccontext_new(mrb);
|
||||||
|
|
||||||
/* Load libraries */
|
/* Load libraries */
|
||||||
for (i = 0; i < args.libc; i++) {
|
for (i = 0; i < args.libc; i++) {
|
||||||
struct REnv *e;
|
|
||||||
FILE *lfp = fopen(args.libv[i], "r");
|
FILE *lfp = fopen(args.libv[i], "r");
|
||||||
if (lfp == NULL) {
|
if (lfp == NULL) {
|
||||||
printf("Cannot open library file. (%s)\n", args.libv[i]);
|
printf("Cannot open library file. (%s)\n", args.libv[i]);
|
||||||
@@ -517,10 +516,8 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
mrb_load_file_cxt(mrb, lfp, cxt);
|
mrb_load_file_cxt(mrb, lfp, cxt);
|
||||||
fclose(lfp);
|
fclose(lfp);
|
||||||
e = mrb_vm_ci_env(mrb->c->cibase);
|
mrb_vm_ci_env_clear(mrb, mrb->c->cibase);
|
||||||
mrb_vm_ci_env_set(mrb->c->cibase, NULL);
|
mrb_ccontext_cleanup_local_variables(mrb, cxt);
|
||||||
mrb_env_unshare(mrb, e, FALSE);
|
|
||||||
mrbc_cleanup_local_variables(mrb, cxt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MRB_NO_MIRB_UNDERSCORE
|
#ifndef MRB_NO_MIRB_UNDERSCORE
|
||||||
@@ -529,7 +526,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
cxt->capture_errors = TRUE;
|
cxt->capture_errors = TRUE;
|
||||||
cxt->lineno = 1;
|
cxt->lineno = 1;
|
||||||
mrbc_filename(mrb, cxt, "(mirb)");
|
mrb_ccontext_filename(mrb, cxt, "(mirb)");
|
||||||
if (args.verbose) cxt->dump_result = TRUE;
|
if (args.verbose) cxt->dump_result = TRUE;
|
||||||
|
|
||||||
ai = mrb_gc_arena_save(mrb);
|
ai = mrb_gc_arena_save(mrb);
|
||||||
@@ -710,7 +707,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
mrb_free(mrb, args.libv);
|
mrb_free(mrb, args.libv);
|
||||||
}
|
}
|
||||||
mrbc_context_free(mrb, cxt);
|
mrb_ccontext_free(mrb, cxt);
|
||||||
mrb_close(mrb);
|
mrb_close(mrb);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user