cvsuser 05/03/29 23:56:17
Modified: classes fixedbooleanarray.pmc
dynclasses tclparser.pmc
Log:
two C89 issues; one is #34608
Courtesy of Peter Sinnott <[EMAIL PROTECTED]>
Revision Changes Path
1.8 +3 -2 parrot/classes/fixedbooleanarray.pmc
Index: fixedbooleanarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/fixedbooleanarray.pmc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- fixedbooleanarray.pmc 29 Mar 2005 19:41:00 -0000 1.7
+++ fixedbooleanarray.pmc 30 Mar 2005 07:56:16 -0000 1.8
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
-$Id: fixedbooleanarray.pmc,v 1.7 2005/03/29 19:41:00 bernhard Exp $
+$Id: fixedbooleanarray.pmc,v 1.8 2005/03/30 07:56:16 leo Exp $
=head1 NAME
@@ -491,8 +491,9 @@
*/
void freeze(visit_info *info) {
IMAGE_IO *io = info->image_io;
+ STRING *s;
io->vtable->push_integer(INTERP, io, PMC_int_val(SELF));
- STRING * s = string_from_cstring(INTERP, PMC_data(SELF),
PMC_int_val2(SELF)/BITS_PER_CHAR);
+ s = string_from_cstring(INTERP, PMC_data(SELF),
PMC_int_val2(SELF)/BITS_PER_CHAR);
io->vtable->push_string(INTERP, io, s);
}
1.8 +44 -44 parrot/dynclasses/tclparser.pmc
Index: tclparser.pmc
===================================================================
RCS file: /cvs/public/parrot/dynclasses/tclparser.pmc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tclparser.pmc 30 Mar 2005 05:57:21 -0000 1.7
+++ tclparser.pmc 30 Mar 2005 07:56:17 -0000 1.8
@@ -1,7 +1,7 @@
/* TclParser.pmc
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: tclparser.pmc,v 1.7 2005/03/30 05:57:21 coke Exp $
+ * $Id: tclparser.pmc,v 1.8 2005/03/30 07:56:17 leo Exp $
* Overview:
* A container for methods related to tcl parsing.
* Data Structure and Algorithms:
@@ -33,12 +33,12 @@
void class_init() {
if (pass) {
- TclList = Parrot_PMC_typenum(INTERP, "TclList");
- StringClass = Parrot_PMC_typenum(INTERP, "String");
- IntegerClass = Parrot_PMC_typenum(INTERP, "Integer");
+ TclList = Parrot_PMC_typenum(INTERP, "TclList");
+ StringClass = Parrot_PMC_typenum(INTERP, "String");
+ IntegerClass = Parrot_PMC_typenum(INTERP, "Integer");
bs_nl = string_from_const_cstring(INTERP, "\\\n",2);
nl = string_from_const_cstring(INTERP, "\n",1);
- cb = string_from_const_cstring(INTERP, "\175",1);
+ cb = string_from_const_cstring(INTERP, "\175",1);
cp = string_from_const_cstring(INTERP, ")",1);
space = string_from_const_cstring(INTERP, " ",1);
ConcatWords = string_from_const_cstring(INTERP, "concat_words",12);
@@ -77,25 +77,22 @@
*/
METHOD PMC* parse(PMC *code, PMC *psw, PMC *bi) {
- INTVAL start_word=0; /* position of the start of the word */
+ INTVAL start_word=0; /* position of the start of the word */
INTVAL word_length; /* length of the word */
INTVAL word_trailing_length; /* include the last char in the word? */
INTVAL character; /* The current character */
- INTVAL last_character; /*The last character */
+ INTVAL last_character; /*The last character */
INTVAL end_of_word; /* Boolean, is the word done? */
PMC *commands; /* List of all the commands parsed */
- PMC *command; /* The current command */
- INTVAL bs_marker = 0;
+ PMC *command; /* The current command */
+ INTVAL bs_marker = 0;
INTVAL bs_pos;
INTVAL bs_retval;
INTVAL bs_diff;
INTVAL bs_a_byte;
INTVAL buffer_length;
INTVAL old_length,chunk_start,escape_length,temppos;
-
- /* XXX running this in class_init is apparently too soon, so run it
here */
- TclWord = Parrot_PMC_typenum(INTERP, "TclWord");
-
+
STRING *buffer = Parrot_PMC_get_string(INTERP, code);
INTVAL preserve_whitespace = Parrot_PMC_get_intval(INTERP, psw);
INTVAL block_interpolation = Parrot_PMC_get_intval(INTERP, bi);
@@ -105,19 +102,22 @@
STRING *S0, *S1;
PMC *P0,*P1,*P2,*P3,*P4;
+ /* XXX running this in class_init is apparently too soon, so run it
here */
+ TclWord = Parrot_PMC_typenum(INTERP, "TclWord");
+
/* backslash/newline substitution */
buffer_length = string_length(INTERP, buffer);
bs_pos = string_str_index(INTERP, buffer, bs_nl, bs_marker);
/* bs_loop_outer: */
while (bs_marker <= buffer_length && bs_pos != -1) {
- bs_marker = bs_pos;
+ bs_marker = bs_pos;
bs_pos+=1;
/* bs_loop_inner */
bs_retval = 1;
while (bs_retval) {
- bs_a_byte = string_index(INTERP,buffer,bs_pos++);
+ bs_a_byte = string_index(INTERP,buffer,bs_pos++);
if (bs_a_byte < 33 && bs_a_byte != 10) {
bs_retval = 1;
} else {
@@ -138,7 +138,7 @@
commands = pmc_new(INTERP,TclList);
- /*
+ /*
* (Do this after the newline_subst since this could change the
* size of the buffer.) ... don't fall off the end
*/
@@ -186,7 +186,7 @@
if (character == 123) {
goto handle_brace;
}
-
+
/* "string" */
if (character == 34) {
goto handle_quote;
@@ -259,7 +259,7 @@
goto handle_variable;
}
-check_bs:
+check_bs:
/* backslash */
if (character == 92) {
goto handle_backslash;
@@ -295,7 +295,7 @@
/* otherwise, stop at the next newline. */
start_word = I0 + 1;
goto begin_command;
-
+
end_command:
/*
* if we're preserving whitespace and we're at the end of the command,
@@ -330,7 +330,7 @@
goto end_command_1;
}
-end_command_0:
+end_command_0:
S0 = string_substr(INTERP, buffer, start_word, word_length, NULL, 0);
P1 = VTABLE_find_method(INTERP, word, ConcatConst);
Parrot_call_method(INTERP, P1, word, ConcatConst, "vS", S0);
@@ -338,13 +338,13 @@
if (preserve_whitespace == 1) {
goto preserve_end_scope;
}
-
+
end_command_1:
/* go to the next word*/
I0 = Parrot_PMC_get_intval(INTERP, command);
if (I0 == 0) {
- goto end_command_2;
+ goto end_command_2;
}
VTABLE_push_pmc(INTERP, commands, command);
@@ -355,7 +355,7 @@
handle_brace:
word_length = Parrot_TclParser_match_close(INTERP, SELF,
buffer,start_word);
- if (word_length < 0) {
+ if (word_length < 0) {
goto bad_block;
}
end_of_word = 1;
@@ -427,7 +427,7 @@
S0 = string_substr(INTERP, buffer, start_word, old_length, NULL, 0);
P1 = VTABLE_find_method(INTERP, word, ConcatConst);
Parrot_call_method(INTERP, P1, word, ConcatConst, "vS", S0);
-
+
handle_variable_1:
/* Are we dealing with a braced-var name? */
if (string_index(INTERP, buffer, ++chunk_start) != 123) {
@@ -455,12 +455,12 @@
handle_variable_nobrace:
temppos = chunk_start;
-
-inner:
+
+inner:
if (++temppos >= buffer_length) {
goto inner_done;
}
-
+
I0 = string_index(INTERP, buffer, temppos);
/* A */
if (I0 < 65) {
@@ -539,7 +539,7 @@
word_length = 0;
backslash_escape:
- /*
+ /*
* get the next character (start_word is now the beginning of the escape)
* XXX Need to make sure we don't walk off the edge here.
*/
@@ -551,43 +551,43 @@
P1 = VTABLE_find_method(INTERP, word, ConcatChar);
if (I0 != 97) {
goto backslash_escape_b;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 7);
goto escape_done;
backslash_escape_b:
if (I0 != 98) {
goto backslash_escape_f;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 8);
goto escape_done;
backslash_escape_f:
if (I0 != 102) {
goto backslash_escape_n;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 12);
goto escape_done;
backslash_escape_n:
if (I0 != 110) {
goto backslash_escape_r;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 10);
goto escape_done;
backslash_escape_r:
if (I0 != 114) {
goto backslash_escape_t;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 13);
goto escape_done;
backslash_escape_t:
if (I0 != 116) {
goto backslash_escape_v;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 9);
goto escape_done;
backslash_escape_v:
if (I0 != 118) {
goto backslash_escape_not;
- }
+ }
Parrot_call_method(INTERP, P1, word, ConcatChar, "vI", 11);
goto escape_done;
@@ -602,7 +602,7 @@
start_word = start_word + escape_length;
goto middle_word;
-handle_command_block:
+handle_command_block:
old_length = word_length;
chunk_start = start_word + word_length;
word_length = Parrot_TclParser_match_close(INTERP, SELF,
buffer,chunk_start);
@@ -676,7 +676,7 @@
/* Given a string and a beginning position in the string, return
* the length of the string that forms a valid tcl construct.
* [], {}, (), "", etc.
- *
+ *
* return -1 if an invalid initial character is found
* return -2 if no closing character is found.
*/
@@ -693,11 +693,11 @@
INTVAL retval = -1;
bufferlen = string_length(INTERP, buffer);
- opener = string_index(INTERP, buffer, index);
+ opener = string_index(INTERP, buffer, index);
if (opener == 123) { /* {} */
hierarchical = 1;
- closer = 125;
+ closer = 125;
} else if (opener == 91) { /* [] */
hierarchical = 1;
closer = 93;
@@ -707,12 +707,12 @@
hierarchical = 1;
closer = 41;
} else {
- return -1;
+ return -1;
/* invalid matching char. */
/* XXX - generate an exception? */
- }
-
- /* state == 1, normal; 2, saw a backslash */
+ }
+
+ /* state == 1, normal; 2, saw a backslash */
/* loop_outer */
while (count != 0) {
@@ -737,7 +737,7 @@
}
retval = position - index + 1;
- return retval;
+ return retval;
}
}