ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 00 00 00 01 00 08 06 00 00 00 5c 72 a8 | .PNG........IHDR.............\r. |
0020 | 66 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0e c3 00 | f....bKGD..............pHYs..... |
0040 | 00 0e c3 01 c7 6f a8 64 00 00 00 07 74 49 4d 45 07 e0 06 09 13 14 36 d7 ac 54 ed 00 00 20 00 49 | .....o.d....tIME......6..T.....I |
0060 | 44 41 54 78 da ec bd 7b b0 65 e9 55 1f f6 5b df 63 ef 7d ce b9 af ee be dd 3d 3d d3 f3 d0 73 66 | DATx...{.e.U..[.c.}......==...sf |
0080 | 34 48 a2 25 64 30 20 cb 48 aa 08 4f 08 04 03 06 57 4c 4c 42 2a a9 20 59 26 81 a2 70 0a 17 e5 c4 | 4H.%d0..H..O....WLLB*..Y&..p.... |
00a0 | 54 2a d8 02 19 c9 06 1c ca 18 07 07 61 10 e2 0f bb 12 1c 4b 40 88 13 40 40 24 81 84 35 30 a3 51 | T*..........a......K@..@@$..50.Q |
00c0 | 34 8f ee e9 e9 be 8f 73 ef 39 7b 7f 8f b5 f2 c7 f7 7d fb ee 7b fa 8e 3c d2 cc 34 9a e9 fd eb ba | 4......s.9{......}..{..<..4..... |
00e0 | d5 b7 6f 9f 7b ef 39 67 ef b5 be b5 7e eb b7 d6 02 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 | ..o.{.9g....~....F..1b...#F..1b. |
0100 | 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c | ..#F..1b...#F..1b...#F..1b...#F. |
0120 | 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 | .1b...#F..1b...#F..1b...#F..1b.. |
0140 | 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 | .#F..1b...#F..1b...#F..1b...#F.. |
0160 | 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 | 1b...#F..1b...#F..1b...#F..1b... |
0180 | 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 | #F..1b...#F..1b...#F..1b...#F..1 |
01a0 | 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 | b...#F..1b...#F..1b...#F..1b...# |
01c0 | 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 | F..1b...#F..1b...#F..1b...#F..1b |
01e0 | c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 11 23 46 | ...#F..1b...#F..1b...#F..1b...#F |
0200 | 8c 18 31 62 c4 88 11 23 46 8c 18 31 62 c4 88 e7 0e ba 55 5e e8 03 af b9 6f 02 e0 fd 20 fa cf 89 | ..1b...#F..1b.....U^....o....... |
0220 | 0c d6 d6 66 98 4e a7 98 4c 26 b8 f3 ce 3b b1 b9 b9 09 22 82 73 0e 31 46 30 33 42 08 60 66 18 63 | ...f.N..L&...;....".s.1F03B.`f.c |
0240 | 50 d7 35 00 60 3e 9f e3 b1 c7 1e c3 c1 c1 01 f6 f7 f7 b1 b3 b3 83 f5 f5 75 4c a7 93 5f 23 a2 6f | P.5.`>..................uL.._#.o |
0260 | ff dd df fd e8 de 78 5b dd 1c 7c f9 97 bf 7e 53 20 bf d8 2e bb 77 1c 1e 1e e2 f4 e9 d3 d8 d8 d8 | ......x[..|...~S.....w.......... |
0280 | c0 c6 c6 06 ee be fb 6e 6c 6c 6c 80 99 b1 58 2c e0 bd 87 88 40 44 40 44 68 9a 06 eb eb eb 20 22 | .......nlll...X,....@D@Dh......" |
02a0 | 3c fd f4 d3 78 f4 d1 47 71 78 78 98 3f 0e 60 ad 41 d3 34 0f 55 b6 fa aa ff e7 b7 7f 67 e7 a5 fa | <...x..Gqxx.?.`.A.4.U.......g... |
02c0 | 1e 9a 5b e5 66 59 9b cd 20 22 60 16 74 3e 40 44 00 00 22 82 10 02 62 8c 20 a2 fe eb 44 04 63 4c | ..[.fY..."`.t>@D.."...b.....D.cL |
02e0 | ff 79 79 2c 33 83 99 7b 27 51 3e 0f 21 40 11 8d 56 79 33 4f 2f a5 00 70 7f 8c 11 51 7f ad ca f5 | .yy,3..{'Q>.!@..Vy3O/..p...Q.... |
0300 | 2a d7 73 f5 df ab 5f 1f 7e 6f 79 1c 73 44 8c fe 25 7d 51 6f 19 07 30 99 4c 20 80 8d 21 c2 85 43 | *.s..._.~oy.sD..%}Qo..0.L...!..C |
0320 | 10 11 94 52 b0 d6 a2 ae 6b 54 55 75 cc c0 01 40 29 d5 ff 5d 9c c3 f0 31 e5 f3 10 02 42 08 20 8c | ...R....kTUu...@)..]...1....B... |
0340 | 0e e0 cf 2c 88 5d 79 eb 57 8d 7f 15 27 39 80 72 bd 89 14 36 36 36 50 55 f5 ae 48 8c a3 03 78 29 | ...,.]y.W...'9.r...666PU..H...x) |
0360 | dc 26 44 44 8a 2e 86 7c 3d cb 05 d7 5a c3 18 03 6b 2d 44 a4 3f d9 87 37 90 d6 1a 4d d3 00 00 bc | .&DD...|=...Z...k-D.?..7...M.... |
0380 | f7 30 c6 f4 37 0b 80 1c 05 f0 68 8b 37 19 5a 6b 30 73 4d 48 7f 4a 24 56 22 ba e2 a0 8b 13 1f 5e | .0..7.....h.7.Zk0sMH.J$V"......^ |
03a0 | b3 92 ee 95 eb 5c fe 5f 29 95 fe ad 0d 48 d1 f9 e0 a2 1e 1d c0 4b 00 21 46 25 41 b6 62 08 c7 c2 | .....\._)....H.......K.!F%A.b... |
03c0 | c5 61 c8 48 2b 21 7c 39 19 56 43 c7 e2 3c ca e3 09 02 02 ce d2 98 03 dc 64 88 66 8e 17 98 23 44 | .a.H+!|9.VC..<..........d.f...#D |
03e0 | 70 43 84 16 07 ce 7e f5 da 0e af eb ea f5 2d 1f 31 72 c7 fc 79 c2 88 d1 01 bc 98 4e 0b c5 ce bb | pC....~.......-.1r..y......N.... |
0400 | c5 90 0c 2a 37 ca 30 ec 3f 29 cc 27 a2 63 ff 5f 6e 20 ad 35 b4 d6 20 a5 20 cc 4b 11 f1 a3 51 de | ...*7.0.?).'.c._n..5......K...Q. |
0420 | 3c 74 6d cb 22 51 62 64 88 f0 91 43 ce 0e 7a 78 e2 af 5e bb 12 15 30 73 ef 0c 8e 45 7f 2c a8 26 | <tm."Qbd...C..zx..^...0s...E.,.& |
0440 | d5 6e 5d d7 7e 74 00 2f 01 44 66 13 43 bc 10 42 38 76 5a ac 86 fc c3 8f f4 d8 e4 00 42 08 bd 23 | .n].~t./.Df.C..B8vZ.........B..# |
0460 | 18 46 0f fd 87 a2 07 44 50 01 38 1c 4d f3 66 05 00 68 98 71 fb f0 04 2f 69 dd 30 9c 1f 3a f5 55 | .F.....DP.8.M.f..h.q.../i.0..:.U |
0480 | 6e a7 44 72 25 62 28 a9 03 20 00 70 fe a5 1e d2 dd 32 0e c0 3b c7 9d f3 7b 3e 04 28 65 6e 08 f7 | n.Dr%b(....p.....2..;...{>.(en.. |
04a0 | 56 4f f8 61 14 40 94 f2 cb 72 43 ad 86 92 5a 69 28 45 fb 31 62 24 02 6e 2a b1 23 0c c0 0d a3 fb | VO.a.@...rC...Zi(E.1b$.n*.#..... |
04c0 | a1 53 2e 27 fc f0 5a af 46 02 c5 01 0c ab 3a fd cf 02 96 20 7a 49 93 80 ea 96 89 00 62 60 e1 78 | .S.'..Z.F.....:.....zI......b`.x |
04e0 | 2d dd 08 b8 c1 01 c8 b3 48 f5 86 8f 1b e6 94 da 18 68 65 e6 a4 46 0a e0 66 82 21 ac 94 8a 4a e9 | -.......H........he..F..f.!...J. |
0500 | e3 9c cc 4a 74 36 e4 6e 4e 4a 05 56 53 84 fe 6f e0 e9 97 38 05 70 eb 38 80 10 a2 10 d1 53 c6 18 | ...Jt6.nNJ.VS..o...8.p.8.....S.. |
0520 | d0 a0 6e bc 7a da af 9e 0e 25 cf 3f 89 1f 28 8f 8f 31 22 c4 70 65 2c 03 de 64 07 10 25 02 d8 2d | ..n.z....%.?..(..1".pe,..d..%..- |
0540 | 39 fc b3 d5 01 0c af f1 33 7d e4 c7 5f 79 a9 bf 87 b7 4c 0a d0 39 0f 00 6d ca fd cc b1 90 f1 99 | 9.......3}.._y....L..9..m....... |
0560 | 08 a3 62 ec 27 b1 c9 c7 22 06 11 68 a3 3d c9 ad ed 00 be e9 9b be 89 6e bb ed 36 cc 66 33 a5 b5 | ..b.'..."..h.=.........n..6.f3.. |
0580 | 96 18 23 9c 73 f2 fe f7 bf ff 05 39 46 09 c4 91 f9 09 16 be f7 99 4e f2 cf 27 04 3a 49 14 94 ee | ..#.s......9F.........N..'.:I... |
05a0 | 87 e4 50 14 d1 4b 5e d5 79 cb 44 00 de 7b 78 ef 33 c9 f3 f9 4f 84 67 3a 41 fa 37 6d 40 34 11 11 | ..P..K^.y.D..{x.3...O.g:A.7m@4.. |
05c0 | b4 31 a8 ab 1a b6 a9 6f 69 07 30 9f cf 71 f5 ea 55 7d 70 70 a0 bd f7 46 29 85 aa aa f0 ce 77 be | .1.....oi.0..q..U}pp...F).....w. |
05e0 | f3 05 f1 8c 5a 6b 18 6d 1c 81 8e 95 f5 86 2c ff d0 b1 0f 6b fd 27 85 ff 47 0e 7f 50 51 18 23 80 | ....Zk.m......,....k.'..G..PQ.#. |
0600 | 97 06 2a 6b 8b 8b 3f d1 c8 87 e5 a0 e2 0c b4 d6 fd df 9f 2f 05 c8 f9 e2 2d 9f 00 7c e4 23 1f 91 | ..*k..?............/....-..|.#.. |
0620 | b7 bd ed 6d ac 94 12 a5 94 34 4d 23 ef 7d ef 7b 5f b0 24 5a 6b 0d 81 0c 14 7c cf 5e 0a fc f9 52 | ...m.....4M#.}.{_.$Zk....|.^...R |
0640 | 80 f2 f3 98 e3 4b fe 8c bc 25 7b 01 5c 88 c7 6e 8a 52 fe 19 7b 01 9e 3b 3e fc e1 0f df b4 4a c8 | .....K...%{.\..n.R..{..;>.....J. |
0660 | f3 d5 0b 30 fc de 14 dd 29 30 c7 5c fa 1d 23 80 97 04 72 2f 00 82 0f f0 71 79 9c 4c 1a 94 fb 56 | ...0....)0.\..#...r/....qy.L...V |
0680 | 6b ca c3 93 61 ec 05 f8 52 c4 73 ef 05 38 29 1a 08 59 31 aa d4 e8 00 5e 1a b7 09 11 40 84 c2 d3 | k...a...R.s..8)..Y1....^....@... |
06a0 | ad de 00 27 91 43 c5 e8 4f 72 04 c5 71 1c 45 11 a3 04 e0 66 43 6b 0d 11 81 56 fa 98 f3 1d 96 03 | ...'.C..Or..q.E....fCk...V...... |
06c0 | 57 43 fe d5 6b 7b 23 01 98 b4 1e 5d d7 a5 a8 10 32 3a 80 97 02 58 44 09 73 cd 91 91 b4 e3 27 13 | WC..k{#....]....2:...XD.s.....'. |
06e0 | 7f 43 d6 7f a8 fa 2b 0d 40 bd fc 77 c5 19 10 51 05 88 1e cd f2 e6 41 44 2c 80 3a 39 77 dc 60 c8 | .C....+.@..w...Q......AD,.:9w.`. |
0700 | ab 8e bb 38 8d f2 79 b9 ce cf d4 0e 2c c2 13 ad b5 1a 1d c0 4b 00 55 5d d7 20 ac 81 08 8b 65 db | ...8..y.....,.......K.U]......e. |
0720 | 77 01 d6 75 8d d9 6c 86 8d 8d 0d 88 08 da b6 3d 36 3c 02 00 8c 31 a8 aa 2a fd 9c aa 3a 26 35 05 | w..u..l........=6<...1..*...:&5. |
0740 | 00 61 06 c7 60 89 46 25 e0 cd 44 e8 dc 29 21 79 43 08 1e 10 f4 5c 8c 73 ae ff 28 58 2d f3 16 f9 | .a..`.F%..D..)!yC....\.s..(X-... |
0760 | 6f 49 e3 ca fd 90 9c 86 c2 d6 a9 d3 98 4d 26 97 40 98 e2 25 2c ef be 75 74 00 ed c2 8b 60 df fb | oI...........M&.@..%,..ut....`.. |
0780 | e7 de 0d 38 7c 6c ba 61 00 22 1c 02 4a 46 b3 bc 99 79 1d 47 00 fb 22 b2 b1 da 0d f8 6c d4 9d cf | ...8|l.a."..JF...y.G..".....l... |
07a0 | d4 0d c8 cc 60 11 30 70 40 f2 d2 76 ea b7 8c 03 58 2c da 98 24 df 7c 83 c8 e7 99 ba 01 8f 1a 43 | ....`.0p@..v....X,..$.|........C |
07c0 | 8e 87 8b c5 01 f4 5a 00 a5 40 50 c0 28 05 fe 82 f1 fd df ff fd e4 9c c3 4f fc c4 4f 7c c1 ce d3 | ......Z..@P.(...........O..O|... |
07e0 | c7 08 ca d7 66 d8 0d 38 ac f7 9f c4 f3 0c 1f 37 74 f2 c3 39 02 e0 ec 18 5e e2 ef ff ad 13 01 74 | ....f..8.......7t..9....^......t |
0800 | 9d 24 2a 00 00 a9 63 46 3e ec 08 1c fe 3d 4c 05 8a b1 97 72 e1 b1 b2 91 52 50 46 e1 56 57 02 9e | .$*...cF>....=L....r....RPF.VW.. |
0820 | 84 8b 77 dc 41 b6 aa b1 b1 b1 8e d9 6c a6 9a a6 a1 d9 6c 46 67 cf 9e 9d 9d 3e 7d ba a9 eb 7a 61 | ..w.A.......l.....lFg....>}...za |
0840 | ad 6d bf ef fb be cf bf e7 3d ef f9 82 ec 4d 22 c0 60 30 1f 1f de 32 fc 58 ad dc 0c d3 81 c2 07 | .m.......=....M".`0...2.X....... |
0860 | 28 a5 7a e3 2f 1d a0 48 33 1e 5e f2 b8 65 1c 40 db 75 fd c5 37 a6 be 21 04 2c 84 df 33 85 89 ab | (.z./..H3.^..e.@.u..7..!.,..3... |
0880 | 9f 0f 1f 6b 6c 85 49 33 81 8c 3a 80 e3 c6 7f 61 9b 98 03 3e f3 99 c7 8b 61 0f 3b eb 76 df f5 ae | ...kl.I3..:....a...>....a.;.v... |
08a0 | 77 3d a0 b5 fe f3 5a eb 4f 57 55 f5 d8 0f fc c0 0f 2c 7e f4 47 7f 34 3c eb 9b d7 9a 1c 9d 09 bc | w=....Z.OWU......,~.G.4<........ |
08c0 | f7 37 34 03 ad 76 03 ae a6 73 ab c4 df 6a 47 e8 ad 80 5b 46 0a 3c 6d 1a 4c 9b 06 75 55 41 a9 e3 | .74..v...s...jG...[F.<m.L..uUA.. |
08e0 | 62 91 1b 7b c1 8f 84 40 d6 da 5e 10 b4 fa d8 63 91 43 4a 42 47 ab 1f e0 b1 27 9f 96 27 9e bc f2 | b..{...@..^....c.CJBG....'..'... |
0900 | 8c 6f ca fb df ff fe 4f 2e 16 8b cf 84 10 5e ae 94 da b0 d6 da 1f fc c1 1f 7c d6 f7 a4 31 06 da | .o.....O......^..........|...1.. |
0920 | 68 28 fd 85 29 01 3f 5f 33 50 a9 f4 a4 d2 6e e8 53 bf d1 01 bc c8 b1 b5 b5 85 cd cd 4d ac cd d6 | h(..).?_3P....n.S...........M... |
0940 | 8e e5 86 25 f7 2b 1f c3 29 40 65 60 68 ea 20 a4 63 0e a0 3c 36 c6 08 ef 7d 62 9d 3b 37 5a fd 17 | ...%.+..)@e`h...c..<6...}b.;7Z.. |
0960 | 88 f7 bd ef 7d 1f 9b cf e7 bf 1f 63 dc 55 4a 79 63 cc b3 f7 a2 99 7d 4d 9f 9f 7c a2 3f 93 03 18 | ....}......c.UJyc.....}M..|.?... |
0980 | f6 fd af f2 06 5a 2b 84 e0 d1 b6 2d ba ee b8 68 ec ef fd 4f ef a6 f7 fd 83 ef 7d c9 84 7a b7 4c | .....Z+....-...h...O......}..z.L |
09a0 | 0a a0 94 4a 21 fa 33 84 79 9f 4f 08 34 ac fb 9f 24 04 4a 6a c0 38 5a f3 17 89 27 9f 7c f2 a9 10 | ...J!.3.y.O.4...$.Jj.8Z...'.|... |
09c0 | 02 9f 3d 7b b6 8f b6 9e 0d ca 49 ad 48 3d ef 42 a0 b6 6d 11 42 e2 80 fe de df 7c 3b 5d bd 76 58 | ..={......I.H=.B..m.B.....|;].vX |
09e0 | 5d 9f fb 3b 1e fd f8 a7 be b2 6e 66 f7 7f ff 7f f1 cd ff c3 df ff 99 0f f9 d1 01 bc 48 e0 63 00 | ]..;......nf................H.c. |
0a00 | 24 49 81 d3 85 ad 7b c7 30 3c 39 ca e9 3e 74 1c 00 7a 1d 40 49 09 ca f7 14 ee 40 1b 03 c8 c8 02 | $I....{.0<9..>t..z.@I.....@..... |
0a20 | 7e 31 f8 d5 5f fd d5 2f ca 7b 52 42 ba 46 2b 42 a0 52 d7 5f 1d e1 36 ec 04 2c d7 99 99 8f 55 0d | ~1.._../.{RB.F+B.R._..6..,....U. |
0a40 | 0a a9 c8 cc b8 f7 8e d9 86 52 ea 35 6b b3 fa ad fb 0b ff b6 c5 e1 c1 25 61 59 8b d1 ff 33 00 7f | .........R.5k..........%aY...3.. |
0a60 | 3a 3a 80 17 0d 09 e8 c5 28 e2 10 3c bc 8f c7 8c 7f 38 3f 2e 84 d0 b3 ff e5 94 49 c4 61 12 89 54 | ::......(..<.....8?.......I.a..T |
0a80 | 55 75 63 9b a9 d6 30 d6 32 48 8d 61 c0 4d 85 0e 45 7b b5 1a 01 14 fe a6 cc 72 1c 46 0d 43 82 b0 | Uuc...0.2H.a.M..E{.......r.F.C.. |
0aa0 | a4 71 43 e7 c0 cc 50 44 d8 9a 56 67 1f b8 6b ed 3d cc fc 3a 8d 78 11 71 51 ed 5d 3d a0 76 b6 81 | .qC...PD..Vg..k.=..:.x.qQ.]=.v.. |
0ac0 | aa 6a 7e 0c c0 37 8e 0e e0 cf 10 3f f4 ee ef a4 18 bd dd b9 f6 34 9e 7a ea 32 ae 5c 7d 1a de 7b | .j~..7.....?.........4.z.2.\}..{ |
0ae0 | d8 4a a3 ae 1b 88 28 34 4d 83 e9 b4 92 6b 87 44 4b 2f 2c 42 00 9d 4c 04 0d 7b c9 57 f3 c6 e1 0d | .J....(4M....k.DK/,B..L..{.W.... |
0b00 | b2 4a 34 81 19 88 51 b4 56 f8 4b 5f 79 af 75 0c 12 21 90 56 60 f6 f0 61 09 8a 11 1b 5b 9b d8 dc | .J4...Q.V.K_y.u..!.V`..a....[... |
0b20 | dc 02 01 08 31 c2 fb 08 e6 88 d6 79 44 31 98 4c 6a 58 6b 60 35 a0 21 98 35 95 51 44 3a 84 80 d6 | ....1......yD1.LjXk`5.!.5.QD:... |
0b40 | 75 10 28 28 63 52 6d 5a 28 95 1f 49 27 0e a2 6b 11 38 a2 ae 27 a8 9a 1a 9a 08 4a 69 18 a5 a1 0d | u.((cRmZ(..I'..k.8..'.....Ji.... |
0b60 | 20 1c a0 08 20 6d 20 10 f8 c8 08 2c 29 23 ca 04 a6 10 72 38 cd 88 02 c4 c8 08 3e 64 45 5d ca b7 | .....m.....,)#....r8......>dE].. |
0b80 | 03 03 fb 7b 07 08 91 31 9d d4 d8 5c ab c0 b1 55 5a 02 ce 6c 6e c4 ad ad cd c8 4a 61 77 af c3 72 | ...{...1...\...UZ..ln.....Jaw..r |
0ba0 | b9 a4 e8 17 c6 2d 0e a7 ad f3 d3 a5 8b d3 65 00 0b d5 f3 cd 8d f5 c5 e6 da 24 4c 27 86 d3 eb 50 | .....-........e..........$L'...P |
0bc0 | 70 de 63 b9 5c 62 d9 2e 10 63 00 29 0d 63 2b 40 08 ce 31 9c f3 88 12 61 b5 81 d5 8a 9f 6c a3 8a | p.c.\b...c.).c+@..1....a.....l.. |
0be0 | 31 ca 50 ca 3b 0c ff 4f ba 86 27 5d db 21 ca 08 30 6d 0c 4e af 99 3b 43 b7 b8 7b 11 18 ae 5d 00 | 1.P.;..O..'].!..0m.N..;C..{...]. |
0c00 | ee 10 6e 79 00 40 63 52 4d ff a3 ef 78 fb 97 df f1 d0 b5 e5 2e a3 56 67 4e 9f 81 31 76 f1 6b bf | ..ny.@cRM...x.........VgN..1v.k. |
0c20 | f6 af e3 e8 00 6e 16 48 ee 00 e4 6f 11 a1 63 19 54 6e 85 00 08 88 04 42 42 cc 14 37 27 11 ce 85 | .....n.H...o..c.Tn.....BB..7'... |
0c40 | af 09 21 c2 28 0d a5 f4 0d e1 a2 88 c0 e6 b9 01 c3 0e c1 55 41 c9 6a 37 e0 7c 3e 87 c4 ee 81 f3 | ..!.(..............UA.j7.|>..... |
0c60 | 5b f5 df 75 a2 1c 11 19 00 42 24 10 08 48 06 2d c5 24 20 56 79 80 80 e4 8f f4 7c d3 39 96 67 16 | [..u.....B$..H.-.$.Vy.....|.9.g. |
0c80 | 2a 25 02 6c 02 f2 8a 54 f1 c6 d1 63 45 d2 5f e8 f9 af fe b3 f4 fb e4 a8 24 49 65 52 81 40 92 5c | *%.l...T...cE._.........$IeR.@.\ |
0ca0 | 09 92 07 68 ac 56 2d 48 d2 ef 27 a2 34 6f b3 ff ef f2 33 08 90 21 79 96 de 71 ad 8d 22 21 d1 d6 | ...h.V-H..'.4o....3..!y..q.."!.. |
0cc0 | 44 22 38 05 62 a5 09 ca 18 23 34 69 2a 52 db 76 c2 77 4e a2 6c 45 46 6b ab fa b3 93 a6 7e 4a 29 | D"8.b....#4i*R.v.wN.lEFk.....~J) |
0ce0 | 0a 94 fc 4f 49 9e 8e 49 6f d2 7b 46 f9 b5 0c ea f2 44 14 18 7e 12 f7 9a eb 0b 39 b7 ec 42 3f e7 | ...OI..Io.{F.....D..~.....9..B?. |
0d00 | 61 75 ca ef 70 76 c3 d0 c9 17 6e 67 55 27 50 5e bf f7 1e 3e 2a b5 7f 18 01 09 88 ac e0 f4 3a 66 | au..pv....ngU'P^...>*.........:f |
0d20 | 5b 0d 22 13 0e bb 0e 4e e4 ff b2 8a fe b4 8b 42 44 34 01 f0 5d 00 fe 64 74 00 37 09 a1 5b 9e 0b | [."....N.......BD4..]..dt.7..[.. |
0d40 | 21 7c 8f eb 16 12 43 07 e1 00 e1 98 0e e4 40 10 28 68 a7 e0 08 10 18 30 47 e2 28 a2 b4 a5 61 29 | !|....C.......@.(h.....0G.(...a) |
0d60 | b0 94 7e 4a 8e 7f 44 ec 85 1b 4e 93 a1 cc b4 dc 34 07 ed 42 34 aa bb dd 54 fe 06 c5 64 dc 49 6f | ..~J..D...N.....4..B4...T...d.Io |
0d80 | a4 00 04 48 8c 10 30 38 78 04 d7 81 84 10 23 23 c6 00 66 01 87 08 66 82 57 04 12 05 51 80 28 82 | ...H..08x.....##..f...f.W...Q.(. |
0da0 | 87 05 2b a2 c8 11 c1 3b 30 08 14 23 20 c9 55 10 29 44 d2 e0 18 10 a3 4f 37 7d 50 f0 65 ac 95 52 | ..+....;0..#..U.)D.....O7}P.e..R |
0dc0 | 10 ad 53 8b 92 44 90 22 c4 18 20 10 84 98 a2 00 66 0c c6 60 2b 68 55 c8/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "lua_api/l_noise.h"
#include "lua_api/l_internal.h"
#include "common/c_converter.h"
#include "common/c_content.h"
#include "log.h"
#include "porting.h"
#include "util/numeric.h"
///////////////////////////////////////
/*
LuaPerlinNoise
*/
LuaPerlinNoise::LuaPerlinNoise(NoiseParams *params) :
np(*params)
{
}
int LuaPerlinNoise::l_get_2d(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoise *o = checkobject(L, 1);
v2f p = readParam<v2f>(L, 2);
lua_Number val = NoisePerlin2D(&o->np, p.X, p.Y, 0);
lua_pushnumber(L, val);
return 1;
}
int LuaPerlinNoise::l_get_3d(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoise *o = checkobject(L, 1);
v3f p = check_v3f(L, 2);
lua_Number val = NoisePerlin3D(&o->np, p.X, p.Y, p.Z, 0);
lua_pushnumber(L, val);
return 1;
}
int LuaPerlinNoise::create_object(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
NoiseParams params;
if (lua_istable(L, 1)) {
read_noiseparams(L, 1, ¶ms);
} else {
params.seed = luaL_checkint(L, 1);
params.octaves = luaL_checkint(L, 2);
params.persist = readParam<float>(L, 3);
params.spread = v3f(1, 1, 1) * readParam<float>(L, 4);
}
LuaPerlinNoise *o = new LuaPerlinNoise(¶ms);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
return 1;
}
int LuaPerlinNoise::gc_object(lua_State *L)
{
LuaPerlinNoise *o = *(LuaPerlinNoise **)(lua_touserdata(L, 1));
delete o;
return 0;
}
LuaPerlinNoise *LuaPerlinNoise::checkobject(lua_State *L, int narg)
{
NO_MAP_LOCK_REQUIRED;
luaL_checktype(L, narg, LUA_TUSERDATA);
void *ud = luaL_checkudata(L, narg, className);
if (!ud)
luaL_typerror(L, narg, className);
return *(LuaPerlinNoise **)ud;
}
void LuaPerlinNoise::Register(lua_State *L)
{
lua_newtable(L);
int methodtable = lua_gettop(L);
luaL_newmetatable(L, className);
int metatable = lua_gettop(L);
lua_pushliteral(L, "__metatable");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__index");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__gc");
lua_pushcfunction(L, gc_object);
lua_settable(L, metatable);
lua_pop(L, 1);
markAliasDeprecated(methods);
luaL_openlib(L, 0, methods, 0);
lua_pop(L, 1);
lua_register(L, className, create_object);
}
const char LuaPerlinNoise::className[] = "PerlinNoise";
luaL_Reg LuaPerlinNoise::methods[] = {
luamethod_aliased(LuaPerlinNoise, get_2d, get2d),
luamethod_aliased(LuaPerlinNoise, get_3d, get3d),
{0,0}
};
///////////////////////////////////////
/*
LuaPerlinNoiseMap
*/
LuaPerlinNoiseMap::LuaPerlinNoiseMap(NoiseParams *params, s32 seed, v3s16 size)
{
m_is3d = size.Z > 1;
np = *params;
try {
noise = new Noise(&np, seed, size.X, size.Y, size.Z);
} catch (InvalidNoiseParamsException &e) {
throw LuaError(e.what());
}
}
LuaPerlinNoiseMap::~LuaPerlinNoiseMap()
{
delete noise;
}
int LuaPerlinNoiseMap::l_get_2d_map(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
size_t i = 0;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v2f p = readParam<v2f>(L, 2);
Noise *n = o->noise;
n->perlinMap2D(p.X, p.Y);
lua_newtable(L);
for (u32 y = 0; y != n->sy; y++) {
lua_newtable(L);
for (u32 x = 0; x != n->sx; x++) {
lua_pushnumber(L, n->result[i++]);
lua_rawseti(L, -2, x + 1);
}
lua_rawseti(L, -2, y + 1);
}
return 1;
}
int LuaPerlinNoiseMap::l_get_2d_map_flat(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v2f p = readParam<v2f>(L, 2);
bool use_buffer = lua_istable(L, 3);
Noise *n = o->noise;
n->perlinMap2D(p.X, p.Y);
size_t maplen = n->sx * n->sy;
if (use_buffer)
lua_pushvalue(L, 3);
else
lua_newtable(L);
for (size_t i = 0; i != maplen; i++) {
lua_pushnumber(L, n->result[i]);
lua_rawseti(L, -2, i + 1);
}
return 1;
}
int LuaPerlinNoiseMap::l_get_3d_map(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
size_t i = 0;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v3f p = check_v3f(L, 2);
if (!o->m_is3d)
return 0;
Noise *n = o->noise;
n->perlinMap3D(p.X, p.Y, p.Z);
lua_newtable(L);
for (u32 z = 0; z != n->sz; z++) {
lua_newtable(L);
for (u32 y = 0; y != n->sy; y++) {
lua_newtable(L);
for (u32 x = 0; x != n->sx; x++) {
lua_pushnumber(L, n->result[i++]);
lua_rawseti(L, -2, x + 1);
}
lua_rawseti(L, -2, y + 1);
}
lua_rawseti(L, -2, z + 1);
}
return 1;
}
int LuaPerlinNoiseMap::l_get_3d_map_flat(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v3f p = check_v3f(L, 2);
bool use_buffer = lua_istable(L, 3);
if (!o->m_is3d)
return 0;
Noise *n = o->noise;
n->perlinMap3D(p.X, p.Y, p.Z);
size_t maplen = n->sx * n->sy * n->sz;
if (use_buffer)
lua_pushvalue(L, 3);
else
lua_newtable(L);
for (size_t i = 0; i != maplen; i++) {
lua_pushnumber(L, n->result[i]);
lua_rawseti(L, -2, i + 1);
}
return 1;
}
int LuaPerlinNoiseMap::l_calc_2d_map(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v2f p = readParam<v2f>(L, 2);
Noise *n = o->noise;
n->perlinMap2D(p.X, p.Y);
return 0;
}
int LuaPerlinNoiseMap::l_calc_3d_map(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v3f p = check_v3f(L, 2);
if (!o->m_is3d)
return 0;
Noise *n = o->noise;
n->perlinMap3D(p.X, p.Y, p.Z);
return 0;
}
int LuaPerlinNoiseMap::l_get_map_slice(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPerlinNoiseMap *o = checkobject(L, 1);
v3s16 slice_offset = read_v3s16(L, 2);
v3s16 slice_size = read_v3s16(L, 3);
bool use_buffer = lua_istable(L, 4);
Noise *n = o->noise;
if (use_buffer)
lua_pushvalue(L, 4);
else
lua_newtable(L);
write_array_slice_float(L, lua_gettop(L), n->result,
v3u16(n->sx, n->sy, n->sz),
v3u16(slice_offset.X, slice_offset.Y, slice_offset.Z),
v3u16(slice_size.X, slice_size.Y, slice_size.Z));
return 1;
}
int LuaPerlinNoiseMap::create_object(lua_State *L)
{
NoiseParams np;
if (!read_noiseparams(L, 1, &np))
return 0;
v3s16 size = read_v3s16(L, 2);
LuaPerlinNoiseMap *o = new LuaPerlinNoiseMap(&np, 0, size);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
return 1;
}
int LuaPerlinNoiseMap::gc_object(lua_State *L)
{
LuaPerlinNoiseMap *o = *(LuaPerlinNoiseMap **)(lua_touserdata(L, 1));
delete o;
return 0;
}
LuaPerlinNoiseMap *LuaPerlinNoiseMap::checkobject(lua_State *L, int narg)
{
luaL_checktype(L, narg, LUA_TUSERDATA);
void *ud = luaL_checkudata(L, narg, className);
if (!ud)
luaL_typerror(L, narg, className);
return *(LuaPerlinNoiseMap **)ud;
}
void LuaPerlinNoiseMap::Register(lua_State *L)
{
lua_newtable(L);
int methodtable = lua_gettop(L);
luaL_newmetatable(L, className);
int metatable = lua_gettop(L);
lua_pushliteral(L, "__metatable");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__index");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__gc");
lua_pushcfunction(L, gc_object);
lua_settable(L, metatable);
lua_pop(L, 1);
markAliasDeprecated(methods);
luaL_openlib(L, 0, methods, 0);
lua_pop(L, 1);
lua_register(L, className, create_object);
}
const char LuaPerlinNoiseMap::className[] = "PerlinNoiseMap";
luaL_Reg LuaPerlinNoiseMap::methods[] = {
luamethod_aliased(LuaPerlinNoiseMap, get_2d_map, get2dMap),
luamethod_aliased(LuaPerlinNoiseMap, get_2d_map_flat, get2dMap_flat),
luamethod_aliased(LuaPerlinNoiseMap, calc_2d_map, calc2dMap),
luamethod_aliased(LuaPerlinNoiseMap, get_3d_map, get3dMap),
luamethod_aliased(LuaPerlinNoiseMap, get_3d_map_flat, get3dMap_flat),
luamethod_aliased(LuaPerlinNoiseMap, calc_3d_map, calc3dMap),
luamethod_aliased(LuaPerlinNoiseMap, get_map_slice, getMapSlice),
{0,0}
};
///////////////////////////////////////
/*
LuaPseudoRandom
*/
int LuaPseudoRandom::l_next(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPseudoRandom *o = checkobject(L, 1);
int min = 0;
int max = 32767;
lua_settop(L, 3);
if (lua_isnumber(L, 2))
min = luaL_checkinteger(L, 2);
if (lua_isnumber(L, 3))
max = luaL_checkinteger(L, 3);
if (max < min) {
errorstream<<"PseudoRandom.next(): max="<<max<<" min="<<min<<std::endl;
throw LuaError("PseudoRandom.next(): max < min");
}
if(max - min != 32767 && max - min > 32767/5)
throw LuaError("PseudoRandom.next() max-min is not 32767"
" and is > 32768/5. This is disallowed due to"
" the bad random distribution the"
" implementation would otherwise make.");
PseudoRandom &pseudo = o->m_pseudo;
int val = pseudo.next();
val = (val % (max-min+1)) + min;
lua_pushinteger(L, val);
return 1;
}
int LuaPseudoRandom::create_object(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
u64 seed = luaL_checknumber(L, 1);
LuaPseudoRandom *o = new LuaPseudoRandom(seed);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
return 1;
}
int LuaPseudoRandom::gc_object(lua_State *L)
{
LuaPseudoRandom *o = *(LuaPseudoRandom **)(lua_touserdata(L, 1));
delete o;
return 0;
}
LuaPseudoRandom *LuaPseudoRandom::checkobject(lua_State *L, int narg)
{
luaL_checktype(L, narg, LUA_TUSERDATA);
void *ud = luaL_checkudata(L, narg, className);
if (!ud)
luaL_typerror(L, narg, className);
return *(LuaPseudoRandom **)ud;
}
void LuaPseudoRandom::Register(lua_State *L)
{
lua_newtable(L);
int methodtable = lua_gettop(L);
luaL_newmetatable(L, className);
int metatable = lua_gettop(L);
lua_pushliteral(L, "__metatable");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__index");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__gc");
lua_pushcfunction(L, gc_object);
lua_settable(L, metatable);
lua_pop(L, 1);
luaL_openlib(L, 0, methods, 0);
lua_pop(L, 1);
lua_register(L, className, create_object);
}
const char LuaPseudoRandom::className[] = "PseudoRandom";
const luaL_Reg LuaPseudoRandom::methods[] = {
luamethod(LuaPseudoRandom, next),
{0,0}
};
///////////////////////////////////////
/*
LuaPcgRandom
*/
int LuaPcgRandom::l_next(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPcgRandom *o = checkobject(L, | '.....{.......O....2:...w.y..... |
2fa0 | e3 a5 10 23 94 36 7d f9 67 7d 7d fd 58 af f8 70 b9 64 71 02 25 02 70 ce e1 e0 e0 20 8f 11 5b a6 | ...#.6}.g}}.X..p.dq.%.p.......[. |
2fc0 | 1d 7f 31 80 45 9a e0 fc bf 7b e2 c9 27 3f 7e 2b 19 ec 7f fb cd f7 d9 77 bc f9 b4 fe 8d 3f b8 f6 | ..1.E....{..'?~+.......w.....?.. |
2fe0 | bc 94 b7 a6 d3 69 5b d7 4d 03 a2 af 13 91 0a 00 22 d4 5a 88 f1 2f 5e 3c 77 f6 4f df f1 35 f7 3d | .....i[.M.......".Z../^<w.O..5.= |
3000 | f1 97 be fc c2 2f 6c af d9 bf 60 28 68 09 8e 7c 48 8b 59 62 9e a4 a4 f2 c8 33 22 85 c0 82 b6 63 | ...../l...`(h..|H.Yb.....3"....c |
3020 | 2c 3b 46 c8 8b 95 8c 4a 1d a3 c5 09 f8 88 bc 26 2d 55 73 9c 6b b3 71 33 26 93 49 3f 3d ba 38 88 | ,;F....J.......&-Us.k.q3&.I?=.8. |
3040 | d5 a6 a1 15 4e a7 8f 02 ea ba 86 52 aa e7 0a 86 2d c7 ed 72 a9 23 e3 75 cc 6a 2a a4 3f fd 86 fb | ....N......R....-..r.#.u.j*.?... |
3060
int LuaPcgRandom::l_rand_normal_dist(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
LuaPcgRandom *o = checkobject(L, 1);
u32 min = lua_isnumber(L, 2) ? lua_tointeger(L, 2) : o->m_rnd.RANDOM_MIN;
u32 max = lua_isnumber(L, 3) ? lua_tointeger(L, 3) : o->m_rnd.RANDOM_MAX;
int num_trials = lua_isnumber(L, 4) ? lua_tointeger(L, 4) : 6;
lua_pushinteger(L, o->m_rnd.randNormalDist(min, max, num_trials));
return 1;
}
int LuaPcgRandom::create_object(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
u64 seed = luaL_checknumber(L, 1);
LuaPcgRandom *o = lua_isnumber(L, 2) ?
new LuaPcgRandom(seed, lua_tointeger(L, 2)) :
new LuaPcgRandom(seed);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
return 1;
}
int LuaPcgRandom::gc_object(lua_State *L)
{
LuaPcgRandom *o = *(LuaPcgRandom **)(lua_touserdata(L, 1));
delete o;
return 0;
}
LuaPcgRandom *LuaPcgRandom::checkobject(lua_State *L, int narg)
{
luaL_checktype(L, narg, LUA_TUSERDATA);
void *ud = luaL_checkudata(L, narg, className);
if (!ud)
luaL_typerror(L, narg, className);
return *(LuaPcgRandom **)ud;
}
void LuaPcgRandom::Register(lua_State *L)
{
lua_newtable(L);
int methodtable = lua_gettop(L);
luaL_newmetatable(L, className);
int metatable = lua_gettop(L);
lua_pushliteral(L, "__metatable");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__index");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__gc");
lua_pushcfunction(L, gc_object);
lua_settable(L, metatable);
lua_pop(L, 1);
luaL_openlib(L, 0, methods, 0);
lua_pop(L, 1);
lua_register(L, className, create_object);
}
const char LuaPcgRandom::className[] = "PcgRandom";
const luaL_Reg LuaPcgRandom::methods[] = {
luamethod(LuaPcgRandom, next),
luamethod(LuaPcgRandom, rand_normal_dist),
{0,0}
};
///////////////////////////////////////
/*
LuaSecureRandom
*/
bool LuaSecureRandom::fillRandBuf()
{
return porting::secure_rand_fill_buf(m_rand_buf, RAND_BUF_SIZE);
}
int LuaSecureRandom::.U\q...3..vUU....`k.....n..p.... | |
3700 | 88 1e 14 c1 a5 10 7c 5f 01 18 f6 02 94 81 20 85 a0 b1 83 4e bf 92 bb 95 c9 b2 6d bb 84 73 3e 9d | ......|_...........N......m..s>. |
3720 | 48 79 3c d8 6c 36 45 f0 01 5a 6b 84 10 ce 56 95 7d e4 d1 47 1f fd bd 31 c0 3f 8e 93 8c ff d4 b7 | Hy<.l6E..Zk...V.}..G...1.?...... |
3740 | 82 be e1 8e 07 ee d7 46 7f 8f 26 f9 36 2d bc ad 21 34 5f 44 3c b9 13 20 50 c7 f2 70 96 23 12 cd | .......F..&.6-..!4_D<...P..p.#.. |
3760 | b9 80 c3 36 62 6f 11 70 7a ad c6 c4 a4 1d 89 94 c7 c2 69 a3 60 ad ce 1b 84 d2 d2 16 1f 53 75 60 | ...6bo.pz.........i.`........Su` |
3780 | d9 79 ec cf 3b 74 81 50 37 6b 3c 99 ae 3d 64 4c f5 53 6d 3c f8 67 f3 76 fa 31 63 d4 42 6b f5 72 | .y..;t.P7k<..=dL.Sm<.g.v.1c.Bk.r |
37a0 | 11 39 53 9c c0 70 52 50 69 04 2a 62 a1 1c e2 7b 11 b1 c3 2e c2 61 55 a0 90 8b cf e4 04 d2 bf 53 | .9S..pRPi.*b...{.....aU........S |
37c0 |
if (count_remaining >= count) {
lua_pushlstring(L, o->m_rand_buf + o->m_rand_idx, count);
o->m_rand_idx += count;
} else {
char output_buf[RAND_BUF_SIZE];
// Copy over with what we have left from our current buffer
memcpy(output_buf, o->m_rand_buf + o->m_rand_idx, count_remaining);
// Refill buffer and copy over the remainder of what was requested
o->fillRandBuf();
memcpy(output_buf + count_remaining, o->m_rand_buf, count - count_remaining);
// Update index
o->m_rand_idx = count - count_remaining;
lua_pushlstring(L, output_buf, count);
}
return 1;
}
int LuaSecureRandom::create_object(lua_State *L)
{
LuaSecureRandom *o = new LuaSecureRandom();
// Fail and return nil if we can't securely fill the buffer
if (!o->fillRandBuf()) {
delete o;
return 0;
}
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);
lua_setmetatable(L, -2);
return 1;
}
int LuaSecureRandom::gc_object(lua_State *L)
{
LuaSecureRandom *o = *(LuaSecureRandom **)(lua_touserdata(L, 1));
delete o;
return 0;
}
LuaSecureRandom *LuaSecureRandom::checkobject(lua_State *L, int narg)
{
luaL_checktype(L, narg, LUA_TUSERDATA);
void *ud = luaL_checkudata(L, narg, className);
if (!ud)
luaL_typerror(L, narg, className);
return *(LuaSecureRandom **)ud;
}
void LuaSecureRandom::Register(lua_State *L)
{
lua_newtable(L);
int methodtable = lua_gettop(L);
luaL_newmetatable(L, className);
int metatable = lua_gettop(L);
lua_pushliteral(L, "__metatable");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__index");
lua_pushvalue(L, methodtable);
lua_settable(L, metatable);
lua_pushliteral(L, "__gc");
lua_pushcfunction(L, gc_object);
lua_settable(L, metatable);
lua_pop(L, 1);
luaL_openlib(L, 0, methods, 0);
lua_pop(L, 1);
lua_register(L, className, create_object);
}
const char LuaSecureRandom::className[] = "SecureRandom";
const luaL_Reg LuaSecureRandom::methods[] = {
luamethod(LuaSecureRandom, next_bytes),
{0,0}
};
|