Bug 5258

Summary: print pointer[0]
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Teresa Thomas <tthomas>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2246, 5292    

Description Andrew Cagney 2007-11-02 16:17:24 UTC
I.e., allow array ops with pointers (and conversely) pointer ops on arrays vis:

print array[0]
print *array
print *pointer
print pointer[0]
Comment 1 Teresa Thomas 2007-11-05 20:02:00 UTC
Dereferencing arrays with * requires word size, word size passed to ALU from
expression evaluator.

Commit:

Implement *(array + index), Call add(), plusEquals() directly from expression
evaluator.

frysk-core/frysk/value/ChangeLog
2007-11-05  Teresa Thomas  <tthomas@redhat.com>

	* TestValue.java: Update.
	* ArithmeticUnit.java (plusEqual): New.
	* ArithmeticType.java (add): Delete.
	(plusEqual): Delete.
	* Type.java (add): Delete.
	(plusEqual): Delete.	
	* TestArray.java (testAdd): New test.
	* AddressUnit.java (AddressUnit(ArrayType, int wordSize)): New. 
	(addArray): New.
	* ArrayType.java (getALU): Give wordSize to ALU.
	* FloatingPointType.java (getALU): Ditto.
	* IntegerType.java (getALU): Ditto.
	* PointerType.java (getALU): Ditto.
	* Type.java (getALU): Ditto.	
	* TypeDecorator.java (add): Delete.
	(plusEqual): Delete.

frysk-core/frysk/expr/ChangeLog
2007-11-05  Teresa Thomas  <tthomas@redhat.com>
	* CExprEvaluator.g (PLUS): Use getALU.
	(PLUSEQUAL): Use getALU.
	* ScratchSymTab.java (getWordSize): Return bogus 
	word size when no task attached.
Comment 2 Teresa Thomas 2007-11-05 22:26:26 UTC
    Implement [] operator for pointers to string.
    
    frysk-core/frysk/value/ChangeLog
    2007-11-05  Teresa Thomas  <tthomas@redhat.com>
    
    	* Type.java (index): Task memory added to parameter list.
    	* PointerType.java (index): New.
    	* TypeDecorator.java (index): Updated.
    	* TestArray.java (testIndexOneD): Updated.
    	(testIndexTwoD): Updated.
    	* TestPointer.java (testCharPointerIndex): New test.
    	* ArrayType.java (dereference): Comments added.
    
    frysk-core/frysk/expr/ChangeLog
    2007-11-05  Teresa Thomas  <tthomas@redhat.com>
    
    	* CExprEvaluator.g (INDEX): Update.
Comment 3 Teresa Thomas 2007-11-07 16:50:19 UTC
Fixed.