summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-09 08:49:38 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-09 08:49:38 +0900
commitf4cf8ea423d8f9df1d341adba63d1416779aae8a (patch)
treeee89b697760d7b528d4767c4ccd1534dadf42bc0 /include
parent2e4e7f7cd15e8ccd6bc6bf8608e0f167f68e2a22 (diff)
downloadmruby-f4cf8ea423d8f9df1d341adba63d1416779aae8a.tar.gz
mruby-f4cf8ea423d8f9df1d341adba63d1416779aae8a.zip
partial VC support
Diffstat (limited to 'include')
-rw-r--r--include/mrbconf.h5
-rw-r--r--include/mruby/khash.h28
-rw-r--r--include/mruby/numeric.h2
-rw-r--r--include/mruby/string.h4
4 files changed, 23 insertions, 16 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h
index b21388f7a..4786d8194 100644
--- a/include/mrbconf.h
+++ b/include/mrbconf.h
@@ -42,4 +42,9 @@ typedef intptr_t mrb_sym;
# define TRUE 1
#endif
+#ifdef _MSC_VER
+# define inline __inline
+# define snprintf _snprintf
+#endif
+
#endif /* MRUBYCONF_H */
diff --git a/include/mruby/khash.h b/include/mruby/khash.h
index 378e1fc2d..5eef2af59 100644
--- a/include/mruby/khash.h
+++ b/include/mruby/khash.h
@@ -17,7 +17,7 @@ typedef khint_t khiter_t;
//extern uint8_t __m[];
/* mask for flags */
-static uint8_t __m[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
+static const uint8_t __m[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
#define __ac_isempty(e_flag, d_flag, i) (e_flag[(i)/8]&__m[(i)%8])
@@ -107,18 +107,20 @@ static uint8_t __m[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
new_n_buckets = INITIAL_HASH_SIZE; \
while( new_n_buckets < limit ) new_n_buckets *= 2; \
} \
- uint8_t *old_e_flags = h->e_flags; \
- khkey_t *old_keys = h->keys; \
- khval_t *old_vals = h->vals; \
- khint_t old_n_buckets = h->n_buckets; \
- h->n_buckets = new_n_buckets; \
- kh_alloc_##name(h); \
- /* relocate */ \
- khint_t i; \
- for( i=0 ; i<old_n_buckets ; i++ ){ \
- if( !__ac_isempty(old_e_flags, old_d_flags, i) ){ \
- khint_t k = kh_put_##name(h, old_keys[i]); \
- kh_value(h,k) = old_vals[i]; \
+ { \
+ uint8_t *old_e_flags = h->e_flags; \
+ khkey_t *old_keys = h->keys; \
+ khval_t *old_vals = h->vals; \
+ khint_t old_n_buckets = h->n_buckets; \
+ h->n_buckets = new_n_buckets; \
+ kh_alloc_##name(h); \
+ /* relocate */ \
+ khint_t i; \
+ for( i=0 ; i<old_n_buckets ; i++ ){ \
+ if( !__ac_isempty(old_e_flags, old_d_flags, i) ){ \
+ khint_t k = kh_put_##name(h, old_keys[i]); \
+ kh_value(h,k) = old_vals[i]; \
+ } \
} \
} \
} \
diff --git a/include/mruby/numeric.h b/include/mruby/numeric.h
index f8ddeb213..8df0ce2b3 100644
--- a/include/mruby/numeric.h
+++ b/include/mruby/numeric.h
@@ -16,7 +16,7 @@
#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
-mrb_value mrb_flt2big(mrb_state *mrb, float d);
+mrb_value mrb_flt2big(mrb_state *mrb, mrb_float d);
void mrb_num_zerodiv(mrb_state *mrb);
mrb_value mrb_fix2str(mrb_state *mrb, mrb_value x, int base);
diff --git a/include/mruby/string.h b/include/mruby/string.h
index 6fe2cc9fd..8e259dfe3 100644
--- a/include/mruby/string.h
+++ b/include/mruby/string.h
@@ -26,9 +26,9 @@ extern const char ruby_digitmap[];
struct RString {
MRUBY_OBJECT_HEADER;
- long len;
+ int len;
union {
- size_t capa;
+ int capa;
struct RString *shared;
} aux;
char *buf;