Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   [Delphi]Max no of Lines in a pas file (http://www.chiefdelphi.com/forums/showthread.php?t=40659)

dilshan80 29-11-2005 02:08

[Delphi]Max no of Lines in a pas file
 
Hi All
I am facing a strange problem, My pas file contains more than 69000 line of code. It compiled successfully but When I apply the break points to debug it appeared in the green colour. Any how it work fine for less than 65535 lines, plz help

Beth Sweet 29-11-2005 08:30

Re: Max no of Lines in a pas file
 
Hi there!
Just wanted to let you know that these are not Delphi forums, but forums for a program called FIRST where both elementry/middle school and high school students design and build a robot to compete in a game that changes every year. While these forums probably won't provide you with the answer to your question, I would urge you to browse both them and the main FIRST website.

Ricky Q. 29-11-2005 09:38

Re: Max no of Lines in a pas file
 
This thread will also help you:

http://www.chiefdelphi.com/forums/sh...ad.php?t=29944

Tristan Lall 29-11-2005 16:58

Re: [Delphi]Max no of Lines in a pas file
 
As noted above, you've come to the wrong place. However, I might be able to assist.

First of all, why do you have 69000 lines in a single Delphi program? You can use more units (.pas source, precompiled to .dcu) to contain large blocks of extra code, either precompiled or as part of the current project. Even if using a console application (.dpr source), you can link to units using the uses command.

Second, green in a breakpoint can mean one of two things; either disabled (if red text on light green) or invalid (if green text on dark yellow). I've just tested some sample code with over 69000 lines in Delphi 7, and apparently, under some circumstances, breakpoints past a certain line will all be invalid. For me, in the sample program, it occurs at around line 3483, but this depends on the whitespace in the top part of the program. Now, if I use a file with a size of a few hundred more than 65535 lines, it still works fine; somewhere between 65535 and 69000, this problem begins to occur. This suggests an IDE limitation or bug.

So the fix? Use more organized code! You must be using tables of constants, right? You can't possibly be crazy enough to be unrolling loops (while that may work, the benefit is very, very small). If it is constants, try separating them into several units, or using less of them!

Incidentally, I believe that in Turbo Pascal 7.0, there was a hard limit of 65536 lines per file, but Delphi should allow arbitrarily long files.

Here's the code used to generate the lines. I used InitialCode to generate a file full of WriteLn statements, then pasted them into the body of the program.

Code:

program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
 
procedure InitialCode;
const
InFile = 'test.pas';
var
A: Cardinal;
F1: TextFile;
begin
Assign(F1, InFile);
Rewrite(F1);
for A := 1 to 69000 do WriteLn(F1, ' WriteLn(''!'');');
CloseFile(F1);
end;
 
begin
WriteLn('!');
WriteLn('!');
WriteLn('!');
WriteLn('!');
// lots of repeated lines: WriteLn('!');
WriteLn('!');
WriteLn('!');
WriteLn('!');
end.



All times are GMT -5. The time now is 04:33.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi