下面是我的一段代码,
type
tagPointMes=record
x,y,r:shortint;
typ_e :integer;
end;
tagRadialLineMes=record
n120,n240,n480:integer;
pPMes:^tagPointMes;
end;
const numcount = 360;
const pi = 3.1415927;
var
LineMes: array[0..numcount] of tagRadialLineMes;
pAllPointMes,pCur :^tagPointMes;上面是程序定义的结构体,
procedure TSA0010.CacuSinCos;
var
seta,i,xx,yy,idx,j,LinePointNum,jj:integer;
x,y,r,TotalPointNum:Integer;
p120 : Array [0..300*numcount] of tagPointMes;
p240 : Array [0..800*numcount] of tagPointMes;
p480 : Array [0..4000*numcount] of tagPointMes;//程序运行到这儿就停止了。提示Stack Overflow...
begin
TotalPointNum:=0;
for i:=0 to numcount do begin
LineMes[i].n120:=0;
LineMes[i].n240:=0;
LineMes[i].n480:=0;
end;
type
tagPointMes=record
x,y,r:shortint;
typ_e :integer;
end;
tagRadialLineMes=record
n120,n240,n480:integer;
pPMes:^tagPointMes;
end;
const numcount = 360;
const pi = 3.1415927;
var
LineMes: array[0..numcount] of tagRadialLineMes;
pAllPointMes,pCur :^tagPointMes;上面是程序定义的结构体,
procedure TSA0010.CacuSinCos;
var
seta,i,xx,yy,idx,j,LinePointNum,jj:integer;
x,y,r,TotalPointNum:Integer;
p120 : Array [0..300*numcount] of tagPointMes;
p240 : Array [0..800*numcount] of tagPointMes;
p480 : Array [0..4000*numcount] of tagPointMes;//程序运行到这儿就停止了。提示Stack Overflow...
begin
TotalPointNum:=0;
for i:=0 to numcount do begin
LineMes[i].n120:=0;
LineMes[i].n240:=0;
LineMes[i].n480:=0;
end;
不是吧,程序再怎么调试也不会停止在那儿啊,你的代码我在delphi7调试,没有问题啊.
unit USA0010FRM;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus;type
TSA0010 = class(TForm)
MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
Help1: TMenuItem;
About1: TMenuItem;
New1: TMenuItem;
procedure Exit1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure CacuSinCos;
{ Public declarations }
end;type
tagPointMes=record
x,y,r:shortint;
typ_e :integer;
end;
tagRadialLineMes=record
n120,n240,n480:integer;
pPMes:^tagPointMes;
end;
const numcount = 360;
const pi = 3.1415927;
var
SA0010 : TSA0010;
LineMes: array[0..numcount] of tagRadialLineMes;
pAllPointMes,pCur :^tagPointMes;implementation
uses math;{$R *.DFM}procedure TSA0010.CacuSinCos;
var
seta,i,xx,yy,idx,j,LinePointNum,jj:integer;
x,y,r,TotalPointNum:Integer;
p120 : Array [0..300*numcount] of tagPointMes;
p240 : Array [0..800*numcount] of tagPointMes;
p480 : Array [0..4000*numcount] of tagPointMes;
begin
TotalPointNum:=0;
for i:=0 to numcount do begin
LineMes[i].n120:=0;
LineMes[i].n240:=0;
LineMes[i].n480:=0;
end;
for x:=0 to 480*2-1 do begin
xx:=(x-480)*(x-480);
for y:=0 to 480*2-1 do begin
yy:=(480-y)*(480-y);
seta:=round(ArcTan2(round((x-480.0)),round((480.0-y)))*180/pi);
if(seta<0) then seta:=360+seta;
if(seta>=360) then seta:=0;
r:=round(sqrt(xx+yy));
if(r<480) then begin
inc(TotalPointNum);
if(r>240) then begin
idx:=seta*4000+LineMes[seta].n480;
p480[idx].x := x - 480 ;
p480[idx].y := y - 480 ;
p480[idx].r := r ;
inc(LineMes[seta].n480);
end
else if(r>120) then begin
idx:=seta*800+LineMes[seta].n240;
p240[idx].x := x - 480 ;
p240[idx].y := y - 480 ;
p240[idx].r := r ;
inc(LineMes[seta].n240);
end
else begin
idx:=seta*300+LineMes[seta].n120;
p120[idx].x := x - 480 ;
p120[idx].y := y - 480 ;
p120[idx].r := r ;
inc(LineMes[seta].n120);
end;
end;
end;
end; GetMem(pAllPointMes,sizeof(tagPointMes)*totalpointNum);
pCur := pAllPointMes;
for i:=0 to numcount do begin
j:=0;
LinePointNum:=0;
LineMes[i].pPMes:=@pCur;
for j:=0 to LineMes[i].n120 do begin
jj:=i*300 + j;
pCur.x := p120[jj].x;
pCur.y := p120[jj].y;
pCur.r := p120[jj].r;
inc(pCur);
end; for j:=0 to LineMes[i].n240 do begin
jj:=i*800 + j;
pCur.x := p240[jj].x;
pCur.y := p240[jj].y;
pCur.r := p240[jj].r;
inc(pCur);
end; for j:=0 to LineMes[i].n480 do begin
jj:=i*480 + j;
pCur.x := p480[jj].x;
pCur.y := p480[jj].y;
pCur.r := p480[jj].r;
inc(pCur);
end; LineMes[i].n480 :=LineMes[i].n480 +LineMes[i].n240;
end;
FreeMem(pAllPointMes)
end;procedure TSA0010.Exit1Click(Sender: TObject);
begin
application.terminate;
end;procedure TSA0010.FormCreate(Sender: TObject);
begin
CacuSinCos;
end;
p120 : Array [0..300*numcount] of tagPointMes;
p240 : Array [0..800*numcount] of tagPointMes;
p480 : Array [0..4000*numcount] of tagPointMes;
把 Max stack size 改大一些看看
考虑 yansea(思宏) 的方法修改对栈大小。