summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--doc/coding_conventions.md48
-rw-r--r--src/time.c5
3 files changed, 51 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 4f85c6c00..8a67ab2a0 100644
--- a/Makefile
+++ b/Makefile
@@ -25,11 +25,6 @@ all :
@$(MAKE) -C src $(MAKE_FLAGS)
@$(MAKE) -C mrblib $(MAKE_FLAGS)
@$(MAKE) -C tools/mruby $(MAKE_FLAGS)
-
-.PHONY : mirb
-mirb :
- @$(MAKE) -C src $(MAKE_FLAGS)
- @$(MAKE) -C mrblib $(MAKE_FLAGS)
@$(MAKE) -C tools/mirb $(MAKE_FLAGS)
# clean up
diff --git a/doc/coding_conventions.md b/doc/coding_conventions.md
new file mode 100644
index 000000000..aa47fe980
--- /dev/null
+++ b/doc/coding_conventions.md
@@ -0,0 +1,48 @@
+# Coding conventions
+
+How to style your C and Ruby code which you want to submit.
+
+## C code
+
+The core part (parser, bytecode-interpreter, core-lib, etc.) of mruby is
+written in the C programming language. Please note the following hints for your
+C code:
+
+### Comply with C99 (ISO/IEC 9899:1999)
+
+mruby should be highly portable to other systems and compilers. For that it is
+recommended to keep your code as close as possible to the C99 standard
+(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).
+
+Although we target C99, VC is also an important target for mruby, so that we
+avoid local variable declaration in the middle.
+
+### Reduce library dependencies to a minimum
+
+The dependencies to libraries should be put to an absolute minimum. This
+increases the portability but makes it also easier to cut away parts of mruby
+on-demand.
+
+### Don't use C++ style comments
+
+ /* This is the prefered comment style */
+
+Use C++ style comments only for temporary comment e.g. commenting out some code lines.
+
+### Insert a break after the method return value:
+
+ int
+ main(void)
+ {
+ ...
+ }
+
+## Ruby code
+
+Parts of the standard library of mruby is written in the Ruby programming language
+itself. Please note the following hints for your Ruby code:
+
+### Comply with the Ruby standard (ISO/IEC 30170:2012)
+
+mruby is currently targeting to execute Ruby code which complies to ISO/IEC
+30170:2012 (http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579).
diff --git a/src/time.c b/src/time.c
index f236b2a77..cf2fd3b91 100644
--- a/src/time.c
+++ b/src/time.c
@@ -26,8 +26,9 @@
/* #define NO_GMTIME_R */
#ifdef _WIN32
-/* unfortunately Win32 platform do not provide gmtime_r/localtime_r */
-#define NO_GMTIME_R
+/* Win32 platform do not provide gmtime_r/localtime_r; emulate them using gmtime_s/localtime_s */
+#define gmtime_r(tp, tm) ((gmtime_s((tm), (tp)) == 0) ? (tp) : NULL)
+#define localtime_r(tp, tm) ((localtime_s((tm), (tp)) == 0) ? (tp) : NULL)
#endif
/* timegm(3) */