yarv-diff:313
From: ko1 atdot.net
Date: 27 Feb 2006 03:47:21 -0000
Subject: [yarv-diff:313] r478 - trunk
Author: aamine
Date: 2006-02-27 12:47:20 +0900 (Mon, 27 Feb 2006)
New Revision: 478
Modified:
trunk/ChangeLog
trunk/parse.y
Log:
* parse.y: follow coding style change.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-02-27 02:53:22 UTC (rev 477)
+++ trunk/ChangeLog 2006-02-27 03:47:20 UTC (rev 478)
@@ -4,6 +4,11 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2006-02-27(Mon) 12:47:10 +0900 Minero Aoki <aamine loveruby.net>
+
+ * parse.y: follow coding style change.
+
+
2006-02-27(Mon) 11:53:07 +0900 Minero Aoki <aamine loveruby.net>
* lib/README: imported from Ruby CVS trunk HEAD.
Modified: trunk/parse.y
===================================================================
--- trunk/parse.y 2006-02-27 02:53:22 UTC (rev 477)
+++ trunk/parse.y 2006-02-27 03:47:20 UTC (rev 478)
@@ -107,11 +107,11 @@
struct RVarmap *vars;
};
-struct vtable{
- ID *tbl;
- int pos;
- int capa;
- struct vtable *prev;
+struct vtable {
+ ID *tbl;
+ int pos;
+ int capa;
+ struct vtable *prev;
};
struct local_vars {
@@ -130,12 +130,12 @@
static int
vtable_size(struct vtable *tbl)
{
- if(POINTER_P(tbl)) {
- return tbl->pos;
- }
- else{
- return 0;
- }
+ if (POINTER_P(tbl)) {
+ return tbl->pos;
+ }
+ else {
+ return 0;
+ }
}
#define VTBL_DEBUG 0
@@ -143,57 +143,57 @@
static struct vtable *
vtable_alloc(struct vtable *prev)
{
- struct vtable *tbl = ALLOC(struct vtable);
- tbl->pos = 0;
- tbl->capa = 8;
- tbl->tbl = ALLOC_N(ID, tbl->capa);
- tbl->prev = prev;
- if(VTBL_DEBUG)printf("vtable_alloc: %p\n", tbl);
- return tbl;
+ struct vtable *tbl = ALLOC(struct vtable);
+ tbl->pos = 0;
+ tbl->capa = 8;
+ tbl->tbl = ALLOC_N(ID, tbl->capa);
+ tbl->prev = prev;
+ if (VTBL_DEBUG) printf("vtable_alloc: %p\n", tbl);
+ return tbl;
}
static void
-vtable_free(struct vtable * tbl)
+vtable_free(struct vtable *tbl)
{
- if(VTBL_DEBUG)printf("vtable_free: %p\n", tbl);
- if(POINTER_P(tbl)){
- if (tbl->tbl) {
- xfree(tbl->tbl);
+ if (VTBL_DEBUG)printf("vtable_free: %p\n", tbl);
+ if (POINTER_P(tbl)) {
+ if (tbl->tbl) {
+ xfree(tbl->tbl);
+ }
+ if (tbl) {
+ xfree(tbl);
+ }
}
- if(tbl){
- xfree(tbl);
- }
- }
}
static void
-vtable_add(struct vtable * tbl, ID id)
+vtable_add(struct vtable *tbl, ID id)
{
- if(!POINTER_P(tbl)){
- rb_bug("vtable_add: vtable is not allocated (%p)", tbl);
- }
- if(VTBL_DEBUG)printf("vtable_add: %p, %s\n", tbl, rb_id2name(id));
-
- if(tbl->pos == tbl->capa){
- tbl->capa = tbl->capa * 2;
- REALLOC_N(tbl->tbl, ID, tbl->capa);
- }
- tbl->tbl[tbl->pos++] = id;
+ if (!POINTER_P(tbl)) {
+ rb_bug("vtable_add: vtable is not allocated (%p)", tbl);
+ }
+ if (VTBL_DEBUG) printf("vtable_add: %p, %s\n", tbl, rb_id2name(id));
+
+ if (tbl->pos == tbl->capa) {
+ tbl->capa = tbl->capa * 2;
+ REALLOC_N(tbl->tbl, ID, tbl->capa);
+ }
+ tbl->tbl[tbl->pos++] = id;
}
static int
vtable_included(struct vtable * tbl, ID id)
{
- int i;
- if(POINTER_P(tbl)){
- for(i=0; i<tbl->pos; i++){
-
- if(tbl->tbl[i] == id){
- return 1;
- }
+ int i;
+
+ if (POINTER_P(tbl)) {
+ for (i = 0; i < tbl->pos; i++) {
+ if (tbl->tbl[i] == id) {
+ return 1;
+ }
+ }
}
- }
- return 0;
+ return 0;
}
/*
@@ -4654,6 +4654,7 @@
#endif /* !RIPPER */
static VALUE lex_get_str(struct parser_params *, VALUE);
+
static VALUE
lex_get_str(struct parser_params *parser, VALUE s)
{
@@ -8028,9 +8029,7 @@
}
static void
-local_push_gen(parser, inherit_dvars)
- struct parser_params *parser;
- int inherit_dvars;
+local_push_gen(struct parser_params *parser, int inherit_dvars)
{
struct local_vars *local;
@@ -8043,8 +8042,7 @@
}
static void
-local_pop_gen(parser)
- struct parser_params *parser;
+local_pop_gen(struct parser_params *parser)
{
struct local_vars *local = lvtbl->prev;
vtable_free(lvtbl->tbl);
@@ -8055,29 +8053,31 @@
}
static ID*
-vtable_to_tbl(struct vtable *src){
- int i, cnt = vtable_size(src);
- if(cnt > 0){
- ID *tbl = ALLOC_N(ID, cnt + 1);
- tbl[0] = cnt;
- for(i=0; i<cnt; i++){
- tbl[i+1] = src->tbl[i];
+vtable_to_tbl(struct vtable *src)
+{
+ int i, cnt = vtable_size(src);
+
+ if (cnt > 0) {
+ ID *tbl = ALLOC_N(ID, cnt + 1);
+ tbl[0] = cnt;
+ for (i = 0; i < cnt; i++) {
+ tbl[i+1] = src->tbl[i];
+ }
+ return tbl;
}
- return tbl;
- }
- return 0;
+ return 0;
}
static ID*
local_tbl_gen(struct parser_params *parser)
{
- return vtable_to_tbl(lvtbl->tbl);
+ return vtable_to_tbl(lvtbl->tbl);
}
static ID*
dyna_tbl_gen(struct parser_params *parser)
{
- return vtable_to_tbl(lvtbl->dvars);
+ return vtable_to_tbl(lvtbl->dvars);
}
static int
@@ -8115,51 +8115,49 @@
return vtable_included(lvtbl->tbl, id);
}
-
-extern int rb_dvar_current();
-extern int rb_scope_base_local_tbl_size();
+extern int rb_dvar_current(void);
+extern int rb_scope_base_local_tbl_size(void);
extern ID rb_scope_base_local_tbl_id(int i);
extern void rb_scope_setup_top_local_tbl(ID *tbl);
static void
top_local_init_gen(struct parser_params *parser)
{
- int i, cnt;
- local_push(rb_dvar_current());
- if(cnt = rb_scope_base_local_tbl_size()){
- if(lvtbl->tbl == 0){
- lvtbl->tbl = vtable_alloc(0);
+ int i, cnt;
+
+ local_push(rb_dvar_current());
+ if (cnt = rb_scope_base_local_tbl_size()) {
+ if (lvtbl->tbl == 0) {
+ lvtbl->tbl = vtable_alloc(0);
+ }
+ for (i = 0; i < cnt; i++) {
+ vtable_add(lvtbl->tbl, rb_scope_base_local_tbl_id(i));
+ }
}
- for(i=0; i<cnt; i++){
- vtable_add(lvtbl->tbl, rb_scope_base_local_tbl_id(i));
- }
- }
}
static void
top_local_setup_gen(struct parser_params *parser)
{
- if(lvtbl->dvars != 0){
- /* eval */
- rb_scope_setup_top_local_tbl(dyna_tbl());
- }
- else{
- rb_scope_setup_top_local_tbl(local_tbl());
- }
- local_pop();
+ if (lvtbl->dvars != 0) {
+ /* eval */
+ rb_scope_setup_top_local_tbl(dyna_tbl());
+ }
+ else {
+ rb_scope_setup_top_local_tbl(local_tbl());
+ }
+ local_pop();
}
static void
-dyna_var_gen(parser, id)
- struct parser_params *parser;
- ID id;
+dyna_var_gen(struct parser_params *parser, ID id)
{
- if(!POINTER_P(lvtbl->dvars)){
+ if (!POINTER_P(lvtbl->dvars)) {
lvtbl->dvars = vtable_alloc(lvtbl->dvars);
}
vtable_add(lvtbl->dvars, id);
- if(!vtable_included(lvtbl->dnames, id)){
- if(!lvtbl->dnames){
+ if (!vtable_included(lvtbl->dnames, id)) {
+ if (!lvtbl->dnames) {
lvtbl->dnames = vtable_alloc(0);
}
vtable_add(lvtbl->dnames, id);
@@ -8167,9 +8165,7 @@
}
static void
-dyna_check_gen(parser, id)
- struct parser_params *parser;
- ID id;
+dyna_check_gen(struct parser_params *parser, ID id)
{
int i;
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml