fortran: allow multi-dimensional subarrays

Add an argument count for subrange expressions in Fortran.
Based on the counted value calculate a new array with the
elements specified by the user.  First parse the user input,
secondly copy the desired array values into the return
array, thirdly re-create the necessary ranges and bounds.

1|  program prog
2|    integer :: ary(10,5) = (/ (i,i=1,10) (j, j=1,5) /)
3|  end program prog

(gdb) print ary(2:4,1:3)
old> Syntax error in expression near ':3'
new> $3 = ( ( 21, 31, 41) ( 22, 32, 42) ( 23, 33, 43) )

2013-11-25  Christoph Weinmann  <christoph.t.weinmann@intel.com>

	* eval.c (multi_f77_subscript): Remove function.
	* eval.c (evaluate_subrange_expr): When evaluating
	an array or string expression, call
	value_f90_subarray.
	* eval.c (value_f90_subarray): Add argument parsing
	and compute result array based on user input.
	* f-exp.y: Increment argument counter for every subrange
	expression entered by the user.
	* valops.c (value_slice): Call value_slice_1 with
	additional default argument.
	* valops.c (value_slice_1): Add functionality to
	copy and return result values based on input.
	* value.h: Add function definition.

Change-Id: Iae343218baeb89c44ac434b5c27741c92805a21b
fortran: combine subarray and string computation

Strings only have one dimension, but the element computation is
identical to the subarray computation for ranges and indices.

2013-11-26  Christoph Weinmann  <christoph.t.weinmann@intel.com>

	* eval.c (evaluate_subexp_standard): Call
	value_f90_subarray for print expressions on array and
	string types.

Change-Id: Ie8031ee99f7fedc6bcd3868dece19b50f47b0c4f
fortran: change subrange enum to bit field

Change Fortran subrange enum for subrange expressions to
represent a bitfield for easier manipulation.  Consequently
also change occurences and evaluation of said enum.  The
behaviour of GDB is unchanged.

2013-11-27  Christoph Weinmann  <christoph.t.weinmann@intel.com>

	* eval.c (value_f90_subarray): Change evaluation of the
	subarray boundaries.  Set boundaries to be either user
	provided (bit in f90_range_type was set) or take the
	default value if the boundary was not provided by the user.
	* f-exp.y (subrange): Change rules for subrange expressions
	to write the relevant bit sequence onto the elt stack.
	* f-lang.h (f90_range_type): Change the enum to use bit
	values for each boundary, if set by the user.
	* parse.c (operator_length_standard): In case of
	OP_F90_RANGE change the calculation of the number of
	arguments on the elt stack, depending on the number of
	boundaries provided by the user.

Change-Id: I7b510070abe3b2831d0b6300e93c62c5eb2f1d0e
fortran: enable parsing of stride parameter for subranges

Allow the user to provide a stride parameter for Fortran
subarrays.  The stride parameter can be any integer except
'0'.  The default stride value is '1'.

2013-11-27  Christoph Weinmann  <christoph.t.weinmann@intel.com>

	* eval.c (value_f90_subarray): Add expression evaluation
	for a stride parameter in a Fortran range expression.
	* f-exp.y: Add yacc rules for writing info on the elt stack
	when the user provided a stride argument.
	* f-lang.h (F90_RANGE): Add field to enum to show when a
	stride was provided by the user.
	* parse.c (operator_length_standard): Check if a stride
	value was provided, and increment argument counter
	accordingly.

Change-Id: I50fc714a1528013023e8ae1db18f57ba0d87ded3
fortran: calculate subarray with stride values.

Calculate elements of a subarray using a user provided stride
value.  The stride value can be a positive or negative
integer, but may not be zero.  If no stride is provided, use
the default value, 1 to print all elements inside the range.

1| program prog
2|   integer :: ary(10) = (/ (i, i=1, 10) /)
3| end program prog

(gdb) print ary(1:10:2)
$3 = (1, 3, 5, 7, 9)

2013-11-27  Christoph Weinmann  <christoph.t.weinmann>

	* eval.c (value_f90_subarray): Add range size calculation
	for stride based ranges, and evaluation of user stride
	parameters.  Add check for matching user input to array
	bounds.
	* valops.c (value_slice): Add call parameter with default
	stride value for calling value_slice_1.
	* valops.c (value_slice_1): Add function parameter for
	stride length in the return subarray.  Calculate array
	elements based on stride value.
	* value.h: Add stride parameter to declaration of
	value_slice_1.

Change-Id: I2a1eb00fc5b14b3fe01b17de4ec67611cbbe6916
fortran: test cases for subarray strides and slices

Add test cases for subarray creation with range, literal and
stride value permutations for one, two, and three dimensional
arrays.

2013-12-04  Christoph Weinmann  <christoph.t.weinmann@intel.com>

testsuite/gdb.fortran/
	* static-arrays.exp: New test.
	* static-arrays.f90: New file.

Change-Id: Ie77d1b1336c72bfb0ac8f06259a02ae155ddd469