# HG changeset patch # User jwe # Date 1139607042 0 # Node ID d01f07aeaec52a35701960c492a857beec112e17 # Parent 4cc6aeb35f932bc580a0fb0fb5f65557acfeeac6 [project @ 2006-02-10 21:30:41 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,7 +1,12 @@ +2006-02-10 John W. Eaton + + * mx-inlines.cc (MX_ND_REDUCTION): Store in cummulative + product of all dimensions in CP_SZ. + 2006-02-09 John W. Eaton * mx-inlines.cc (MX_ND_CUMULATIVE_OP): Store in cummulative - product of all dimensions in CP. + product of all dimensions in CP_SZ. 2006-02-09 David Bateman diff --git a/liboctave/mx-inlines.cc b/liboctave/mx-inlines.cc --- a/liboctave/mx-inlines.cc +++ b/liboctave/mx-inlines.cc @@ -415,10 +415,12 @@ \ The strategy here is to access the elements of A along the \ dimension specified by DIM. This means that we loop over each \ - element of R and adjust the index into A as needed. */ \ + element of R and adjust the index into A as needed. Store the \ + cummulative product of all dimensions of A in CP_SZ. The last \ + element of CP_SZ is the total number of elements of A. */ \ \ - Array cp_sz (nd, 1); \ - for (int i = 1; i < nd; i++) \ + Array cp_sz (nd+1, 1); \ + for (int i = 1; i <= nd; i++) \ cp_sz(i) = cp_sz(i-1)*dv(i-1); \ \ octave_idx_type reset_at = cp_sz(dim); \ diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2006-02-10 John W. Eaton + + * lex.l (\[{S}*): Maybe set lexer_flags.looking_at_return_list or + lexer_flags.looking_at_matrix_or_assign_lhs here. + * parse.y + (return_list_beg): Don't use in_return_list here. + (assign_lhs, matrix): Don't use in_matrix_or_assign_lhs here. + (in_matrix_or_assign_lhs, in_return_list): Delete unused macros. + (matrix): Clear lexer_flags.looking_at_matrix_or_assign_lhs in all + cases. + 2006-02-09 John W. Eaton * utils.cc (oct_file_in_path): Check len > 4, not len > 2. diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -484,6 +484,11 @@ lexer_flags.quote_is_transpose = false; lexer_flags.convert_spaces_to_comma = true; + if (lexer_flags.defining_func && ! lexer_flags.parsed_function_name) + lexer_flags.looking_at_return_list = true; + else + lexer_flags.looking_at_matrix_or_assign_lhs = true; + promptflag--; eat_whitespace (); diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -601,18 +601,19 @@ { $$ = $1; } ; -in_matrix_or_assign_lhs - : // empty - { lexer_flags.looking_at_matrix_or_assign_lhs = true; } - ; - matrix : '[' ']' - { $$ = new tree_constant (octave_value (Matrix ())); } + { + $$ = new tree_constant (octave_value (Matrix ())); + lexer_flags.looking_at_matrix_or_assign_lhs = false; + } | '[' ';' ']' - { $$ = new tree_constant (octave_value (Matrix ())); } - | '[' in_matrix_or_assign_lhs matrix_rows ']' { - $$ = finish_matrix ($3); + $$ = new tree_constant (octave_value (Matrix ())); + lexer_flags.looking_at_matrix_or_assign_lhs = false; + } + | '[' matrix_rows ']' + { + $$ = finish_matrix ($2); lexer_flags.looking_at_matrix_or_assign_lhs = false; } ; @@ -866,9 +867,9 @@ assign_lhs : simple_expr { $$ = new tree_argument_list ($1); } - | '[' in_matrix_or_assign_lhs arg_list CLOSE_BRACE + | '[' arg_list CLOSE_BRACE { - $$ = $3; + $$ = $2; lexer_flags.looking_at_matrix_or_assign_lhs = false; } ; @@ -1147,10 +1148,6 @@ { curr_sym_tab = tmp_local_sym_tab; } ; -in_return_list : // empty - { lexer_flags.looking_at_return_list = true; } - ; - // =========================== // List of function parameters // =========================== @@ -1223,7 +1220,7 @@ // List of function return value names // =================================== -return_list_beg : '[' in_return_list local_symtab +return_list_beg : '[' local_symtab ; return_list : return_list_beg return_list_end