Forgive me if I'm saying BS but it's been about 10 years since I
programmed in TurboPascal (and used ShortStrings), but don't
ShortStrings use the size they are declared with? And 255 is just
default size (if no size is specified)?
The shortstring type does, but you can use a pointer to a
Also, using some compiler trickery can be done to optimize usage of
AnsiStrings so we can avoid use of PChars, but of course this will
have to wait a bit.
Or programmer trickery - the fpc souce already contains lots of programmer
trickery around
ansistrings such as using uniquestring,
.
.
have tight custom units with no end user units like sysutils. One way to
accomplish
this,
like I've already mentioned, is to use shortstring/longstring/array of
string/ based
Dos
unit, using shortstrings where necessary, arrays of strings where
necessary, and
arrays of
IMHO this whole discussion is nonsense. For basic path related stuff,
ansistring is good enough, and if findfirst/findnext are still limiting with
the current memmgr (afaik we changed to Micha's one since those original
tests).
Moreover, if the weak point of ansistrings is the heap copying
writeln('Let''s combine a short string with a wordstring.. (press enter)');
readln;
sstring:= ', interesting world.';
WordStrConcat(sstring, wordstr1); // no memory allocated
sorry, forgot to include the actual shortstring overloaded function - my copy
and paste
skills are getting
The SysUtils unit misses some performance tweaks that the Dos unit has.
Especially for the FindFirst/FindNext part. But this has low prio for the
current developpers so it hasn't been analysed and fixed yet.
What do you guys thing about the idea to implement what DEC Pascal and Extended
On 17 mei 2006, at 19:59, L505 wrote:
What do you guys thing about the idea to implement what DEC Pascal
and Extended Pascal
have - a 2 byte length ShortString (MediumString?), uprdade *some* of
the path related
ShortStrings to be MediumString[1000] instead of ShortString[255
We wouldn't have to use sysutils yet.. we could make a custom Dos unit
which used longstrings instead of short strings, but keep the old
Dos unit for compatibility..
This still means that someone has to finish and test longstring
support in the compiler, and create this longstring Dos
Well, dos.exec of course requires the entire command line as a
shortstring. This is no problem for Dos because Dos has a maximum
path length of 128
chars.
so with 2 max length paths plus some options in the command line your
screwed with shortstrings?
Could happen, but also it might
In the compiler source, when is this defined or for which platforms? is there
any
information on this define and when it is used? for example, on Windows I see
that
dos unit is used by default rather than sysutils. Is sysutils optional?
___
fpc-devel
I'm really surprised about the amount of short strings used on the FPC compiler
source,
such as short strings being used even to pass to Exec() when the linker is
called on
windows. This is obviously why for the past few years I've had all sorts of
chopped off
issues with FPC and got weird
Are you getting rid of shortstring in general or just short strings
that are utilized for paths?
I think it's only the shortstrings for paths that cause problems.
It was a local copy experiment of my own compiler so don't worry I'm not
committing to SVN
:-)
Well the problem I saw was that
By the way - was it ever possible in Delphi or FPC to define a very special
short string
to be of the length longer than 255, let's say
string[1000]
I remember that coming up once before on the mailing list but I forget the end
result of
the conversation.
Not that this is the answer to all our
well it would have to have a different in memory format. Maybe a -1 based
array with the first two locations used for length would do it.
Add new types that extend the 255 limit, using more bytes for storage to double
and even
triple our current 255 limit.
QShortString: 255 X 4 with 4 bytes
var
qss: QuadShortString[1020]; // why not use DoubleShortString ?
tss: TripleShortString[765];
dss: DoubleShortString[510];
ss: ShortString[255];
Vincent.
Because my math is horrible and I need to take a Computer Science course :-)
Just posting some more information: here is the verbose output when using the
-va option:
Searching file c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe... found
Using util c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe
hello.pas(16,1) Error: Can't call the linker, switching to
On Sun, 14 May 2006, Florian Klaempfl wrote:
The error numbers didn't change, they are keep unique.
I propose to do the following:
- add an option -vm (machine readable output)
Using this option the compiler outputs the messages csv like and flushes
after each message:
message type
Try to add a LD param that increases LD's verbosity. Then see if the problem
is LD's parsing. It could be that there are still shortstrings here and
there in the compiler, but 255 chars limits are not likely.
The LD man page says to pass --verbose .. will do some testing and report
Do you know that FPC will have a Package system available in fpc 2.1.1,
sooner or
later?
It will require shipping the RTL in a package, I think - which means we get
into
Package
hell like BPL's offered. I'd rather have the ability to load one package
and not have
to
ship the RTL
yeah that technique requires far less stubs but it means that the coder has
to manually call an init function.
also how does your code respond if one of the entry points isn't found?
Myself I use
{$IFDEF DEBUG}
if getprocaddress(somefunc) = nil then write('somefunc getproc error');
{$ENDIF
- Original Message -
From: Peter Vreman [EMAIL PROTECTED]
To: FPC developers' list fpc-devel@lists.freepascal.org
Sent: Monday, April 10, 2006 12:18 AM
Subject: Re: [fpc-devel] bug ID #4855
Buys Regarding this bug #4855 I need to get it fixed..
The issue like this... I have 2
When compiling a simple hello world DSO (dynamic link library) on linux
Finalization did not occur for units in the uses clause. (testing on fpc 2.0.2)
Is smart linking supposed to work on DSO's, or is it a known problem?
When I tested on MS Windows, finalization did occur.
Just wondering
Okay, I know this is a beginner questions, but how do I create a Pascal
program that only reads the text and sends it through some sort of CGI
thing (i.e. doesn't pop up that DOS-style window/shell). I already know how
to do the CGI part, I just need to know how to make a program
I'm all for it. The question is: base or extra. Or even FCL.
fpnet package. The FCL is only basic stuff, some extended RTL. IMHO the
fpimage,db and xml shall also be moved to fpimage, fpdb and fpxml
packages.
Why prefix everything with fp ?
I think it will be more obvious as to why it is
Op Sun, 29 Jan 2006, schreef VisionForce:
You gave me this link:
http://www.delphibasics.co.uk/ByFunction.asp?Main=Strings
Are these methods supported by FreePascal, or would I need to be using Lazarus
(Delphi)?
And in addition to Daniel's comment, the documentation for these units for FPC
Okay, I know this is a beginner questions, but how do I create a Pascal
program that only reads the text and sends it through some sort of CGI thing
(i.e. doesn't pop up that DOS-style window/shell). I already know how to do
the CGI part, I just need to know how to make a program without a
It's not the advocacy that is needed but rather they need code for it to work.
It
says right in the article.
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
One string is incremented, the other decremented. Your conclusion applies
only to
s:=s;
That's what I was trying to get at.. in order for the example to make sense
there
must be two strings in action.. i.e. one is incremented, and another is
decremented,
rather than the same one. Which is
Ah now I understand your problem, but you miss the point that we are not
refcounting the variable S, but its contents.
Thanks for clearing up - I understand, and these messages will be archived for
future
reference when my brain gets twisted up again.
In this case, it decrements 1 and increments 1, so we will always end up
with a
very
simple, easy, solvable problem.
1 - 1 = 0
1 - 1 = 0
Nope, since the string was nil, it isn't decremented, so you end up with
a refcount of 1
The string is 1, not nil
1 - 1 = 0 from your diagram
correction: 1 - 1 does not = 1 ...
From your diagram, I got this:
String refcount: 2
Decrement(string) (1 - 1 = 1)
string - 'some string'
Increment(string) (1 + 1 = 2)
We are at 2 again. What was the point of doing it at all?
Correction:
What I meant was actually this:
couldn't find them - but if I can't find them, who can? (unless I'm a
clutz, which is highly possible).
--
L505
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
?
--
L505
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
, even if it
works
on my machine as is.
--
L505
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
Do you have the source code for test 7 so we can run it through different CPU
architectures?
nevermind, my bad, I see the email attachment.
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
But why do you read char by Char? Why not
read(f, line);
result := result + line;
You can add a line break in between as well if you want.
close(F); //close file
end;
Jonas
Yes tried that, and on my computer readln with string concatenation actually
locks
up the computer (only
But why do you read char by Char? Why not
read(f, line);
result := result + line;
In my next post I will send you some links to the archives which discussed
some of
this if I can find them.
http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg04686.html
After trying
The reference count is part of the ansistring itself. An ansistring
is simply a pointer to a record containing a reference count, the
amount of memory currently allocated for the string (i.e., maximum
length -1) and the string itself (a 0-terminated string).
So when passing a string from a
Athlon 2.6G +Gentoo
Here are tests on a Celeron 400 Windows 2000 then
Welcome to the CPU war for StrLoadFile.. Please wait...
test 1 (char) execution time: 9287434
test 2 (blokread 1) execution time: 267230
test 3 (blockread fsize) execution time: 262710
test 7 (blokread tHandle) execution
In short (don't pin me on the names or on exact details in special cases):
Assume you have a ansistring and you assign something to it
S := 'SomeString';
the compiler generates something like
DecStringRef(S);
S - 'SomeString';
IncStringRef(S);
The DecStringRef() decrements
Concerning the shoutout test, simply adding a
SetTextBuf(input,1);
(or even higher) before the while loop should speed it up significantly.
The default buffer is 255 chars, which is simply too small.
I'm also going to try this with my CPU-WARS email I sent to the mailing list a
while
This does not make sense to me. When you return a string (from a
function in a DLL or anywhere else), this string will have a
reference count of at least 1 and thus will not be cleaned up by anyone.
The only problem I can see that can occur is in case the program and
the DLL indeed use
I just tried the bug report source code at
http://www.freepascal.org/bugs/showsource.php3?ID=4538
And I did not get an access violation or any errors.
Which proves that it depends on your random luck on a random day ;)
http://z505.com/images/BrokenDLLisWorking.png
Unrelated note:
The PNG I
Concerning the shoutout test, simply adding a
SetTextBuf(input,1);
(or even higher) before the while loop should speed it up significantly.
I'm also going to try this with my CPU-WARS email I sent to the mailing list
// TEST 5
function StrLoadFile_test5(const FileName: string):
I think stringlist.loadfile should use block reading rather than the overhead
of
using streams.
Of course stringlist is an array of strings so this may not work.. time will
tell
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
I still have not seen a single actual problem mentioned with an
explanation by what exactly it is caused, only vague hand waving
warning for strange and inexplicable problems. I'm really interested
by what these problems are and can be caused. Does every dll have its
own memory manager data
. Whereas if you go in
knowing what memory you are allocating, you can understand your mistakes and
fix them
rather than try to play more tricks.
--
L505
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo
The usage of strings in the samples was just to verify which code was
executed and where things went wrong. I wasen't aware of the fact that
that alone could cause problems. In the actual application mainly
objects are passed to functions as regular and out parameters and a
boolean is
3. Are there any real world applications made with Free Pascal/Lazarus?
I guess that even a manager is able to type fpc or lazarus into
google.
And he'll find a bunch of fanboy websites.
True.. we can create directories more like Torry.net instead of things like
PasWiki
which
I think like how torry.net, Delphi 3000, etc. work (but you obviously can
create
smaller websites than that) people should be building independent websites to
promote
freepascal.
I would diagree. Up to now there a tons of sites concering FPC/Lazarus:
freepascal.org, sourceforge,
Florian Klaempfl schrieb:
Why ;)? Indeed, if you want generated docs from comments, better use pasdoc.
the source scanner used by fpDoc supports reading of comments for quite
some time; but as I already told you (or was it Mattias?), the final
support in fpDoc is still missing.
If
I don't think the GNU C compiler is popular because of one nice
website. I think the
reason GNU C compiler is successful is because of all the fan boys
I'm quite sure it's mainly successful because it's the default (and
often only) C compiler on Linux systems, as well as ported to pretty
The way to get users do
more work in writing
documentation, is to have a comment system right up live on the
website. Even the PHP
manual does this ;-)
yeah the accuracy of said information leaves a LOT to be desired though
imo if this is done someone needs to be resposible for
I read the very interesting article about the Systems fair:
http://www.freepascal.org/wiki/index.php/Systems_2005
One conclusion was that the web appearance needs to be improved:
..
The websites are a serious problem. They are quite ugly and not very
intuitive, and this is the case for
I implementing exporting from programs in svn trunk. Did someone test?
Okay, I envy you Florian. But we all do.
From the minimal tests I have done - it works just as I had explained in the
original mail :)
The big test will be when I compile the big ugly and beautiful Lazarus RB beast
on
At http://www.freepascal.org/docs-html/ref/refsu55.html there is a little bug
that I have been
meaning to tell about
Just change
file:../prog/prog.htm
to
../prog/prog.htm
p.s. where is the best place to report documentation bugs/spelling errors/etc.
In a bug report or on the list? or
I implementing exporting from programs in svn trunk. Did someone test?
are you trying to implement it now?
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
I have found a large PDF file to study which contains a lot of
information about Elf and object file format. Hope to get my feet wet.
Have also downloaded the Linker sources to see what exactly it does
differently when it receives the -E option.
If gcc can do it also fpc can be made to do it.
| Okay, I researched the topic. Of course, yes, you can export functions from
an
executable
| on linux. But freepascal doesn't seem to like it just yet.
|
| How do you intend to use the exported symbols of an stand-alone
| executable?
| As a shared library, or how else?
A shared library can
[moved to devel]
|
| With regards to gnu linux:
| How about the Elf format?
| Is it possible to export code from an elf? (i.e. export functions)
|
Okay, I researched the topic. Of course, yes, you can export functions from an
executable
on linux. But freepascal doesn't seem to like it just
I think the idea is that exception handling should be kept separate in case a
user wants to use his own exception handling. If the user explicitly wants
to use exception handling, he just includes the sysutils unit.
However, I suppose if the sysutils unit involves some extra code bloat (due to
While working on some functions in the strwrap1.zip package I am upgrading, I
have found the need for a new low level function I think.
Something similar to
ReadLn(F,Line)
This one is slightly different:
PassLn(F)
Instead of reading the line, copying the text the line into a Line var, the
|
| Now the question I have is: does Pascal already have a function
| like this?
|
| Yes: readln(f)
|
|
| Jonas
|
Wonderful..
Hmm, how do we add this to the FPDOC help safely, since it isn't doesn't seem to
be created automatically by FPDOC? Maybe we could just make another example demo
for
I've always wanted to find the most compact and readable font myself. Just never
spent the time looking.
Well today I did a bit of searching, and found some fonts that are more compact
than at least Courier New
http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=Compact-Readable-Fonts
Save about twice
Subject: Re: [fpc-devel] {$DEFINE x := something}
| On Thursday 30 June 2005 21:34, Florian Klaempfl wrote:
| Christian Iversen wrote:
| On Thursday 30 June 2005 20:15, L505 wrote:
| I've always wanted to find the most compact and readable font myself.
| Just never spent the time looking
Well I get 79 lines in FP-IDE
http://z505.com/images/fonts/FPvsLaz.png
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
| Please move this thread to fpc-other. This has nothing todo with pascal.
Neither did Florian's or Christians font related posts, and neither do the
smiley's we posted have anything to do with Pascal.
:o)
I think the effeciency of your development environment and setup you are using
to create
I use fastcode stuff some times, I just never spend too much time figuring out
how all the code works.
The way I do it is I create my software application first in Pascal.. Then if I
find a huge bottleneck, I pull in a optimized function in place of the old one..
even if I dont' understand the
Borland's compiler does register variables better than FPC and can do
induction variables. This has a large impact on the code generation in
general.
|I thought I saw that FPC beat Kylix in several cases in the timings
|that were posted.
I saw this too, so what do you mean Daniƫl .. in the
Where do I find the cpu/cpu-timer unit guys...
Directory? Download link?
Thank you.
|
| On 12 Jun 2005, at 00:12, Martin Schreiber wrote:
|
| Some more test results with PII 350MHz and
| two additional implementations with lookup table:
|
| Try also with register variables on (-O???r), it
| Where do I find the cpu/cpu-timer unit guys...
| Directory? Download link?
|
| Thank you.
|
Is this the one? ;-)
http://members.yline.com/~tom_at_work/
|
| |
| | On 12 Jun 2005, at 00:12, Martin Schreiber wrote:
| |
| | Some more test results with PII 350MHz and
| | two additional
http://dennishomepage.gugs-cats.dk/LowerCaseChallenge.htm
LowerCaseShaPas2_c
This one here is in Pascal, using GOTO and LABEL which consistently work fast on
both -Og and -OG
But no one wants to maintain a GOTO and a LABEL..
[LowerCaseShaPas2_c] was slightly slower than [lowercase 6 ] (second
While converting a KOL regular expression unit for use with freepascal, I came
across only one compile error, in {$mode delphi}
The error was here:
const
RegExprInvertCaseFunction :
TRegExprInvertCaseFunction=TRegExpr.InvertCaseFunction;
Error: Typed constants of the type procedure of object
| The error was here:
| const
| RegExprInvertCaseFunction :
| TRegExprInvertCaseFunction=TRegExpr.InvertCaseFunction;
|
| Can you create a complete example and in the best case add it to the bug
| repository please?
Yes, just thought I'd first figure out whether the code was wrong, but I
| {$define {:= begin} //this works
| {$define }:= end. } //this doesn't work
| {$define }:= end; } //this doesn't work
|
| Are you sure that the first example really works? It might do somehting
| unexpected, even if the compiler doesn't complain.
I just tried it on short code, and it
|
| Another question: if someone already owns Delphi, they could compile any
source code
| from their Delphi CD with freepascal? Is this legal?
|
| Compilation for private use is legal. Borland disallows to distribute
| their library source code, also in compiled (object) form unless as part
|
|
| | Do not look at delphi copyrighted source, but get info from public sources
| | like helpfiles for download on Borlands FTP etc.
| |
| | This should be enough to reconstruct a rough interface, details will then
| | later be found by testing real delphi code.
| |
|
| I was just wondering, are
For all the keyboard wussies out there:
Note, for all you that are afraid of long reduntant begin/end typing, you could
go
{$define beg:=begin}
Or
program Project1;
{$mode objfpc}{$H+}
{$define b:= begin }
{$define e:= end }
{$define e:=end }
var
iLoc:integer;
b
b
for iLoc:= 1 to 60
Some of the incompatibilities first need to be brought about through
experimentation.
So start figuring out what -specific- delphi units that you actually need to get
working now. If you have a specific unit or source code that needs to be
working -today-, then at least you can submit the exact
Some of the incompatibilities first need to be brought about through
experimentation.
So start figuring out what -specific- delphi units that you actually need to get
working now. If you have a specific unit or source code that needs to be
working -today-, then at least you can submit the exact
| If you don't want to use the form designer, Lazarus is a capable code
| editor with good support for include files for KOL/freepascal projects
| too. Just use a program or custom program in Lazarus.
|
| Vincent.
I use Lazarus all the time.. but form editor would be nice in the future.
Creating
| procedure x (const str: string);
| begin
|filewrite (filedescriptor,pchar(str+#13#10)^,length(str)+2);
| end;
|
| I do not think this should work. You can't pass the address of a temp
| like this.
|
| Fixed for delphi mode only
{$MODE slacker}
Good idea, only for slacker mode.. real
- Original Message -
From: Nikolay Nikolov [EMAIL PROTECTED]
To: FPC developers' list fpc-devel@lists.freepascal.org
Sent: Monday, June 06, 2005 1:16 AM
Subject: Re: [fpc-devel] Extend the libraries people!
| Bisma Jayadi wrote:
|
| Object pascal is a mature language. Some languages
|
| lol - thats not what I meant. If you want readable code you indent
| inside the begin..end blocks ergo the begin..end syntax becomes
| redundant cause its the indentation that provides the visual cue.
|
That's like taking question marks out of sentences that you know are questions.
Why
have
Neat, I haven't come across these yet.
If you -have- got some working under FPC you should upload them to contributed
units
section. Because if other people convert the units which have already been done
by
someone else, we would be doing double work ;-) Plus it gets code into a central
| will respect your wishes and no feelings will be hurt. I believe it will
| help Pascal and breathe new life into it especially as its a dying
| language. I also note there is no such thing as Pascal as such even
| Delphi has significant syntax differences with earlier pascal variants
| so I
|
|
| I'am a poor delphi programmer, didn't use it for years, but I bet with
| any
| python programmer that I create any application faster than him :)
|
|
| You must be a damn fast typer then :)
Sometimes it's which keys are near the home key. I don't care if { is shorter
than
begin,
| More code bloat, more typing and they get in the way. They dont give me
| anything useful in return.
Why do you even bother using Pascal, it seems you obviously do not like one bit
about
it.
|
|
| Garbage collection is largely no issue when using the Owner concept in
TComponent,
using
| In C++:
|
| TStringList strlist;
|
| strlist = new TStringList;
|
| How is that shorter ?
|
| okay but its still redundant. Why does the compiler need to have it
| spelt out twice? Why cant the compiler deduce that as the pointer is
| declared as TStringlist therefore it creates a
.
| This apps are really of size that's not acceptable.
|
| 1. To who?
| 2. And why?
|
I think the guy is mixing up LCL with FCL.
Lars aka L505
http://z505.com
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org
90 matches
Mail list logo