POINT1:
I'm trying to port my XGLCD Library (http://www.pocketmt.com/index.php?target=xglcdoverview) to mikroPascal for AVR, and I'm facing a strange problem with arithmetic operator involving pointers.
well I reduced all my code to the minimum that reproduce the problem (so the code is not that usefull, but compiling it generates the error).
Code: Select all
program prj1;
{ Declarations section }
{'
' Name : xGLCD Library
'
' Author : M. Ahmed Lazreg
' octal@pocketmt.com
'
' Copyright 2007 - Pocket MicroTechnics
' http://www.pocketmt.com
'
' Version : 1.0.0
' Date : 20/07/2007
'
' Software: Compiled Using mikroPascal v6.0.0.2
'
'
' Desc. : xGLCD Library adds support of BIG Proportional font sizes to GLCD Lib.
'
'
}
const xGlcdSelFont : ^byte;
const xColorClear = 0;
xColorSet = 1;
xColorInvert= 2;
var xGlcdX, xGlcdY : byte;
xGlcdSelFontHeight, xGlcdSelFontWidth,
xGlcdSelFontOffset, xGlcdSelFontNbRows : byte;
xGLCD_Transparency : boolean;
function xGlcd_Write_Char(ch, x, y, color : byte): byte;
const CurCharData : ^byte;
var i,j, CharWidth, CharData : byte;
cOffset : longint;
begin
cOffset := xGlcdSelFontWidth * xGlcdSelFontNbRows+1;
cOffset := cOffset * (ch-xGlcdSelFontOffset);
CurCharData := xGlcdSelFont+cOffset;
CharWidth := CurCharData^;
cOffset := cOffset + 1;
for i := 0 to CharWidth-1 do
begin
for j := 0 to xGlcdSelFontNbRows-1 do
begin
CurCharData := xGlcdSelFont+(i*xGlcdSelFontNbRows)+j+cOffset;
case color of
0 : CharData := 0;
1 : CharData := CurCharData^;
2 : CharData := not (CurCharData^);
end;
//xGLCD_Write_Data(x+i,y+j*8,CharData);
end;
end;
result := CharWidth;
end;
begin
{ Main program }
end.
52 1012 Warning: Implicit typecast of integral value to pointer prj1.mpas
52 341 Operator "+" not applicable to these operands "xGlcdSelFont" prj1.mpas
52 341 Operator "+" not applicable to these operands "xGlcdSelFont" prj1.mpas
54 304 Syntax error: Expected ";" but ":=" found prj1.mpas
... other errors
The error operator "+" is not applicable is really strange
The error is visible at the line after the BEGIN after FOR J loop, in the line
Code: Select all
CurCharData := xGlcdSelFont+(i*xGlcdSelFontNbRows)+j+cOffset;
I can send you all the project if you need it.
Notice: all XGLCD Lib code compiles fine under PIC mikroP compiler.
I used mikroPascal Pro for AVR Beta 1.2 (actual beta I downloded it from this forum link two hours ago).
I simply created a new project, selected Atmega16 as a target processor and kept all other things to default values. I saved the project and copied/Pasted this code as main source. This should reproduce the error.
Conditions: Athlon 64 Processor 2.4GHz, RAM 2GB, WinXP-Pro (32bit version) with all latest updates and SP.
POINT2:
Also note that in the Editor (in the IDE), in VAR declaration section, the declaration
Code: Select all
xGLCD_Transparency : boolean;
POINT3:
In the editor, if you open any file, and simply click on an expanded region in order to fold it, and you click again to unfold (expand) a region of code, the region is marked as modified (yellow vertical line) despite the fact that you didnt changed anything nor typed any keyboard button.
Regards
octal