• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

超漢字上で、mrubyを使ってhello worldを表示させる。


Commit MetaInfo

Révision6f774dc65e25fae19a71c66293b6ffbe3b4fa4e6 (tree)
l'heure2017-06-05 23:18:29
Auteurornse01 <ornse01@user...>
Commiterornse01

Message de Log

add gems for B-right/V posix wrapper.

Change Summary

Modification

--- /dev/null
+++ b/src/mrbgems_port/mruby-brightv-posixwrapper/mrbgem.rake
@@ -0,0 +1,5 @@
1+MRuby::Gem::Specification.new('mruby-brightv-posixwrapper') do |spec|
2+ spec.license = 'MIT'
3+ spec.authors = ['ornse01']
4+ spec.summary = 'posix wrapper for B-right/V port'
5+end
--- /dev/null
+++ b/src/mrbgems_port/mruby-brightv-posixwrapper/src/posix.c
@@ -0,0 +1,85 @@
1+#include "../../../posix_include/stdio.h"
2+#include "../../../posix_include/math.h"
3+#include <bstring.h>
4+#include <bstdarg.h>
5+#include <bstdlib.h>
6+
7+#include "mruby.h"
8+
9+double __nan()
10+{
11+ static char nan_byte[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff};
12+ return *(double*)nan_byte;
13+}
14+
15+int isnan(double x)
16+{
17+ double nan = NAN;
18+ return memcmp(&x, &nan, sizeof(double)) == 0;
19+}
20+
21+int isinf(double x)
22+{
23+ double inf = INFINITY;
24+ double ninf = -inf;
25+ return (memcmp(&x, &inf, sizeof(double)) == 0) || (memcmp(&x, &ninf, sizeof(double)) == 0);
26+}
27+
28+int isfinite(double x)
29+{
30+ return !isinf(x);
31+}
32+
33+int signbit(double x)
34+{
35+ return x < 0.0;
36+}
37+
38+double fmod(double x, double y)
39+{
40+ return (x - y * (double)((int)(x / y)));
41+}
42+
43+int fprintf(FILE* stream, const char* format, ...)
44+{
45+ int ret = 0;
46+
47+ if (*stream == stderr || *stream == stdout) {
48+ va_list list;
49+ va_start(list, format);
50+ ret = vprintf(format, list);
51+ va_end(list);
52+ }
53+
54+ return ret;
55+}
56+
57+int snprintf(char *s, size_t len, const char* format, ...)
58+{
59+ int ret = 0;
60+ int len0 = (len < 509) ? 509 : len;
61+ char *p;
62+ va_list list;
63+
64+ p = malloc(sizeof(char)*len0*3);
65+
66+ va_start(list, format);
67+ ret = sprintf(p, format, list);
68+ va_end(list);
69+
70+ memcpy(s, p, ret > len ? len : ret);
71+
72+ free(p);
73+
74+ return ret;
75+}
76+
77+void
78+mrb_mruby_brightv_posixwrapper_gem_init(mrb_state* mrb)
79+{
80+}
81+
82+void
83+mrb_mruby_brightv_posixwrapper_gem_final(mrb_state* mrb)
84+{
85+}