Permalink
Browse files

use C style comments instead of C++ style comments

According to CONTRIBUTING.md,

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.
  • Loading branch information...
1 parent 9b65a0d commit 67de10bfcb9d9ff21e1aa678aff8afa10446b7c4 @cubicdaiya cubicdaiya committed Feb 28, 2014
@@ -16,5 +16,5 @@ mrb_c_and_ruby_extension_example_gem_init(mrb_state* mrb) {
void
mrb_c_and_ruby_extension_example_gem_final(mrb_state* mrb) {
- // finalizer
+ /* finalizer */
}
@@ -16,5 +16,5 @@ mrb_c_extension_example_gem_init(mrb_state* mrb) {
void
mrb_c_extension_example_gem_final(mrb_state* mrb) {
- // finalizer
+ /* finalizer */
}
View
@@ -9,61 +9,61 @@
/* configuration options: */
/* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
-//#define MRB_USE_FLOAT
+/* #define MRB_USE_FLOAT */
/* add -DMRB_INT16 to use 16bit integer for mrb_int; conflict with MRB_INT64 */
-//#define MRB_INT16
+/* #define MRB_INT16 */
/* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT16 */
-//#define MRB_INT64
+/* #define MRB_INT64 */
/* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT */
-//#define MRB_NAN_BOXING
+/* #define MRB_NAN_BOXING */
/* define on big endian machines; used by MRB_NAN_BOXING */
-//#define MRB_ENDIAN_BIG
+/* #define MRB_ENDIAN_BIG */
/* represent mrb_value as a word (natural unit of data for the processor) */
-// #define MRB_WORD_BOXING
+/* #define MRB_WORD_BOXING */
/* argv max size in mrb_funcall */
-//#define MRB_FUNCALL_ARGC_MAX 16
+/* #define MRB_FUNCALL_ARGC_MAX 16 */
/* number of object per heap page */
-//#define MRB_HEAP_PAGE_SIZE 1024
+/* #define MRB_HEAP_PAGE_SIZE 1024 */
/* use segmented list for IV table */
-//#define MRB_USE_IV_SEGLIST
+/* #define MRB_USE_IV_SEGLIST */
/* initial size for IV khash; ignored when MRB_USE_IV_SEGLIST is set */
-//#define MRB_IVHASH_INIT_SIZE 8
+/* #define MRB_IVHASH_INIT_SIZE 8 */
/* turn off generational GC by default */
-//#define MRB_GC_TURN_OFF_GENERATIONAL
+/* #define MRB_GC_TURN_OFF_GENERATIONAL */
/* default size of khash table bucket */
-//#define KHASH_DEFAULT_SIZE 32
+/* #define KHASH_DEFAULT_SIZE 32 */
/* allocated memory address alignment */
-//#define POOL_ALIGNMENT 4
+/* #define POOL_ALIGNMENT 4 */
/* page size of memory pool */
-//#define POOL_PAGE_SIZE 16000
+/* #define POOL_PAGE_SIZE 16000 */
/* initial minimum size for string buffer */
-//#define MRB_STR_BUF_MIN_SIZE 128
+/* #define MRB_STR_BUF_MIN_SIZE 128 */
/* arena size */
-//#define MRB_GC_ARENA_SIZE 100
+/* #define MRB_GC_ARENA_SIZE 100 */
/* fixed size GC arena */
-//#define MRB_GC_FIXED_ARENA
+/* #define MRB_GC_FIXED_ARENA */
/* -DDISABLE_XXXX to drop following features */
-//#define DISABLE_STDIO /* use of stdio */
+/* #define DISABLE_STDIO */ /* use of stdio */
/* -DENABLE_XXXX to enable following features */
-//#define ENABLE_DEBUG /* hooks for debugger */
+/* #define ENABLE_DEBUG */ /* hooks for debugger */
/* end of configuration */
View
@@ -304,7 +304,7 @@ mrb_value mrb_obj_clone(mrb_state *mrb, mrb_value self);
/* need to include <ctype.h> to use these macros */
#ifndef ISPRINT
-//#define ISASCII(c) isascii((int)(unsigned char)(c))
+/* #define ISASCII(c) isascii((int)(unsigned char)(c)) */
#define ISASCII(c) 1
#define ISPRINT(c) (ISASCII(c) && isprint((int)(unsigned char)(c)))
#define ISSPACE(c) (ISASCII(c) && isspace((int)(unsigned char)(c)))
View
@@ -55,17 +55,17 @@ mrb_irep *mrb_read_irep(mrb_state*, const uint8_t*);
#define MRB_DUMP_DEFAULT_STR_LEN 128
-// binary header
+/* binary header */
struct rite_binary_header {
- uint8_t binary_identify[4]; // Binary Identifier
- uint8_t binary_version[4]; // Binary Format Version
- uint8_t binary_crc[2]; // Binary CRC
- uint8_t binary_size[4]; // Binary Size
- uint8_t compiler_name[4]; // Compiler name
+ uint8_t binary_identify[4]; /* Binary Identifier */
+ uint8_t binary_version[4]; /* Binary Format Version */
+ uint8_t binary_crc[2]; /* Binary CRC */
+ uint8_t binary_size[4]; /* Binary Size */
+ uint8_t compiler_name[4]; /* Compiler name */
uint8_t compiler_version[4];
};
-// section header
+/* section header */
#define RITE_SECTION_HEADER \
uint8_t section_identify[4]; \
uint8_t section_size[4]
@@ -77,7 +77,7 @@ struct rite_section_header {
struct rite_section_irep_header {
RITE_SECTION_HEADER;
- uint8_t rite_version[4]; // Rite Instruction Specification Version
+ uint8_t rite_version[4]; /* Rite Instruction Specification Version */
};
struct rite_section_lineno_header {
View
@@ -24,7 +24,7 @@ typedef khint_t khiter_t;
#define UPPER_BOUND(x) ((x)>>2|(x)>>1)
-//extern uint8_t __m[];
+/* extern uint8_t __m[]; */
/* mask for flags */
static const uint8_t __m_empty[8] = {0x02, 0x08, 0x20, 0x80};
View
@@ -16,9 +16,9 @@ typedef struct global_variable {
mrb_value *data;
mrb_value (*getter)(void);
void (*setter)(void);
- //void (*marker)();
- //int block_trace;
- //struct trace_var *trace;
+ /* void (*marker)(); */
+ /* int block_trace; */
+ /* struct trace_var *trace; */
} global_variable;
struct global_entry {
@@ -8,7 +8,7 @@
#include "mt19937ar.h"
/* Period parameters */
-//#define N 624
+/* #define N 624 */
#define M 397
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
@@ -1,7 +1,7 @@
/*
-// random.h - Random module
-//
-// See Copyright Notice in mruby.h
+** random.h - Random module
+**
+** See Copyright Notice in mruby.h
*/
#ifndef RANDOM_H
@@ -216,15 +216,15 @@ mrb_struct_set_m(mrb_state *mrb, mrb_value obj)
return mrb_struct_set(mrb, obj, val);
}
-#define is_notop_id(id) (id)//((id)>tLAST_TOKEN)
-#define is_local_id(id) (is_notop_id(id))//&&((id)&ID_SCOPE_MASK)==ID_LOCAL)
+#define is_notop_id(id) (id) /* ((id)>tLAST_TOKEN) */
+#define is_local_id(id) (is_notop_id(id)) /* &&((id)&ID_SCOPE_MASK)==ID_LOCAL) */
int
mrb_is_local_id(mrb_sym id)
{
return is_local_id(id);
}
-#define is_const_id(id) (is_notop_id(id))//&&((id)&ID_SCOPE_MASK)==ID_CONST)
+#define is_const_id(id) (is_notop_id(id)) /* &&((id)&ID_SCOPE_MASK)==ID_CONST) */
int
mrb_is_const_id(mrb_sym id)
{
@@ -251,7 +251,7 @@ make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * k
}
if (mrb_const_defined_at(mrb, klass, id)) {
mrb_warn(mrb, "redefining constant Struct::%S", name);
- //?rb_mod_remove_const(klass, mrb_sym2name(mrb, id));
+ /* ?rb_mod_remove_const(klass, mrb_sym2name(mrb, id)); */
}
c = mrb_define_class_under(mrb, klass, RSTRING_PTR(name), klass);
}
@@ -262,7 +262,7 @@ make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * k
mrb_define_class_method(mrb, c, "new", mrb_instance_new, MRB_ARGS_ANY());
mrb_define_class_method(mrb, c, "[]", mrb_instance_new, MRB_ARGS_ANY());
mrb_define_class_method(mrb, c, "members", mrb_struct_s_members_m, MRB_ARGS_NONE());
- //RSTRUCT(nstr)->basic.c->super = c->c;
+ /* RSTRUCT(nstr)->basic.c->super = c->c; */
ptr_members = RARRAY_PTR(members);
len = RARRAY_LEN(members);
for (i=0; i< len; i++) {
@@ -137,7 +137,7 @@ mrb_time_update_datetime(struct mrb_time *self)
}
if (!aid) return NULL;
#ifdef NO_GMTIME_R
- self->datetime = *aid; // copy data
+ self->datetime = *aid; /* copy data */
#endif
return self;
View
@@ -1931,7 +1931,6 @@ mrb_init_class(mrb_state *mrb)
struct RClass *obj; /* Object */
struct RClass *mod; /* Module */
struct RClass *cls; /* Class */
- //struct RClass *krn; /* Kernel */
/* boot class hierarchy */
bob = boot_defclass(mrb, 0);
View
@@ -535,15 +535,15 @@ for_body(codegen_scope *s, node *tree)
node *n2;
mrb_code c;
- // generate receiver
+ /* generate receiver */
codegen(s, tree->cdr->car, VAL);
- // generate loop-block
+ /* generate loop-block */
s = scope_new(s->mrb, s, tree->car);
lp = loop_push(s, LOOP_FOR);
lp->pc1 = new_label(s);
- // generate loop variable
+ /* generate loop variable */
n2 = tree->car;
if (n2->car && !n2->car->cdr && !n2->cdr) {
genop(s, MKOP_Ax(OP_ENTER, 0x40000));
@@ -718,7 +718,7 @@ gen_values(codegen_scope *s, node *t, int val)
int is_splat;
while (t) {
- is_splat = (intptr_t)t->car->car == NODE_SPLAT; // splat mode
+ is_splat = (intptr_t)t->car->car == NODE_SPLAT; /* splat mode */
if (n >= 127 || is_splat) {
if (val) {
pop_n(n);
@@ -756,7 +756,7 @@ gen_values(codegen_scope *s, node *t, int val)
}
return -1;
}
- // normal (no splat) mode
+ /* normal (no splat) mode */
codegen(s, t->car, val);
n++;
t = t->cdr;
@@ -1531,7 +1531,7 @@ codegen(codegen_scope *s, node *tree, int val)
int rhs = cursp();
if ((intptr_t)t->car == NODE_ARRAY && nosplat(t->cdr)) {
- // fixed rhs
+ /* fixed rhs */
t = t->cdr;
while (t) {
codegen(s, t->car, VAL);
@@ -1580,7 +1580,7 @@ codegen(codegen_scope *s, node *tree, int val)
}
}
else {
- // variable rhs
+ /* variable rhs */
codegen(s, t, VAL);
gen_vmassignment(s, tree->car, rhs, val);
}
@@ -1913,7 +1913,7 @@ codegen(codegen_scope *s, node *tree, int val)
break;
case NODE_ARG:
- // should not happen
+ /* should not happen */
break;
case NODE_BLOCK_ARG:
@@ -2444,7 +2444,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
}
p->lineno = prev->lineno;
- // debug setting
+ /* debug setting */
p->debug_start_pos = 0;
if(p->filename) {
mrb_debug_info_alloc(mrb, p->irep);
@@ -2921,7 +2921,7 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
scope->filename = p->filename;
scope->filename_index = p->current_filename_index;
if (setjmp(scope->jmp) == 0) {
- // prepare irep
+ /* prepare irep */
codegen(scope, p->tree, NOVAL);
proc = mrb_proc_new(mrb, scope->irep);
mrb_irep_decref(mrb, scope->irep);
View
@@ -8,12 +8,13 @@
#include <stdint.h>
#include <stddef.h>
-// Calculate CRC (CRC-16-CCITT)
-//
-// 0000_0000_0000_0000_0000_0000_0000_0000
-// ^|------- CRC -------|- work --|
-// carry
-#define CRC_16_CCITT 0x11021ul //x^16+x^12+x^5+1
+/* Calculate CRC (CRC-16-CCITT)
+**
+** 0000_0000_0000_0000_0000_0000_0000_0000
+** ^|------- CRC -------|- work --|
+** carry
+*/
+#define CRC_16_CCITT 0x11021ul /* x^16+x^12+x^5+1 */
#define CRC_XOR_PATTERN (CRC_16_CCITT << 8)
#define CRC_CARRY_BIT (0x01000000)
View
@@ -10,7 +10,7 @@ get_file(mrb_irep_debug_info *info, uint32_t pc)
int32_t count;
if(pc >= info->pc_count) { return NULL; }
- // get upper bound
+ /* get upper bound */
ret = info->files;
count = info->flen;
while (count > 0) {
@@ -24,9 +24,9 @@ get_file(mrb_irep_debug_info *info, uint32_t pc)
--ret;
- // check returning file exists inside debug info
+ /* check returning file exists inside debug info */
mrb_assert(info->files <= ret && ret < (info->files + info->flen));
- // check pc is within the range of returning file
+ /* check pc is within the range of returning file */
mrb_assert((*ret)->start_pos <= pc &&
pc < (((ret + 1 - info->files) < info->flen)
? (*(ret+1))->start_pos : info->pc_count));
@@ -77,7 +77,7 @@ mrb_debug_get_line(mrb_irep *irep, uint32_t pc)
return f->line_ary[pc - f->start_pos];
case mrb_debug_line_flat_map: {
- // get upper bound
+ /* get upper bound */
mrb_irep_debug_info_line *ret = f->line_flat_map;
uint32_t count = f->line_entry_count;
while (count > 0) {
@@ -91,9 +91,9 @@ mrb_debug_get_line(mrb_irep *irep, uint32_t pc)
--ret;
- // check line entry pointer range
+ /* check line entry pointer range */
mrb_assert(f->line_flat_map <= ret && ret < (f->line_flat_map + f->line_entry_count));
- // check pc range
+ /* check pc range */
mrb_assert(ret->start_pos <= pc &&
pc < (((ret + 1 - f->line_flat_map) < f->line_entry_count)
? (ret+1)->start_pos : irep->debug_info->pc_count));
@@ -185,7 +185,7 @@ mrb_debug_info_append_file(mrb_state *mrb, mrb_irep *irep,
m.line = irep->lines[start_pos + i];
ret->line_flat_map[ret->line_entry_count] = m;
- // update
+ /* update */
++ret->line_entry_count;
prev_line = irep->lines[start_pos + i];
}
Oops, something went wrong.

0 comments on commit 67de10b

Please sign in to comment.