Re: [fpc-pascal] rotating bits

2006-05-27 Thread DSTRODT




> Michael Van Canneyt wrote:>Well, if we're going in 
that direction anyway: >Why not include all possible assembler 
instructions then ?>>Let's be serious. You must draw the line 
somewhere.>I think these instructions are so exotic, they are pollution 
of the system unit.

 
I agree with Michael. And I think the line is clearly drawn. The FPC 
(and more importantly the language syntax itself) design goal, as I 
understand it, is to be, as much as possible, platform and architecture 
independent and doesn't need to be "polluted" by adding esoteric 
functions/(worst yet)operators becuase they are neat on one particular type of 
machine and we just program around them everywhere else.
Rather, if your application really needs that function, you have 
a number of suggestions on how to implement that within your own 
application, so do that, but I don't think the compiler should be expected to do 
it for you. 
 
Dave
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-27 Thread Arne Hanssen
L505 wrote:
> I'm lacking some memory concept here. Below program doesn't work unless 
> setlengths
> are called first on the shortstrings.
> 
>   setlength(last3, 3);
>   last3[1]:= filename[length(filename)-2];
>   last3[2]:= filename[length(filename)-1];
>   last3[3]:= filename[length(filename)];

As already explained, you must tell 'last3' its length.  As you already
are using a somewhat "lowlevel" approach, you could replace the state-
ment 'setlength(last3, 3);' with 'last3[0]:=chr(3);'.

-- 
Vennlig hilsen / Best regards  |\ ___,,--,_
Arne Hanssen, Senja, Norway/,`--''\-,,__,'/
http://www.tuxic.net/ |,4   ) )_) /~-'
-'---^~(_/-_)--(_/_)---
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] unit name with dots

2006-05-27 Thread mariano podesta
We don't support every bug/strange thing delphi supports.ok, i understand your point.
in my very humble opinion it was an interesting idea.If you want to insult people you might do it somewhere else. Thank you.
it was a joke. not aiming to offend anybody.thanks,marianop
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] unit name with dots

2006-05-27 Thread mariano podesta
None of the FPC developers currently has the time nor wish to supportany of the .NET enhancements, and that includes the dot in the unit
names.despite it was originally intended for .net, i don't see it as a .net specific enhancement, but it's ok.
i appreciate your answer. Michael.marianop
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-27 Thread Jonas Maebe


On 27 May 2006, at 09:46, Arne Hanssen wrote:


  setlength(last3, 3);
  last3[1]:= filename[length(filename)-2];
  last3[2]:= filename[length(filename)-1];
  last3[3]:= filename[length(filename)];


As already explained, you must tell 'last3' its length.  As you  
already

are using a somewhat "lowlevel" approach, you could replace the state-
ment 'setlength(last3, 3);' with 'last3[0]:=chr(3);'.


Note that the setlength will generate exactly the same code as the  
'last3[0]:=chr(3);' statement, so it's better to keep the setlength  
(in case the string would ever become an ansistring, or just for  
readability)



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] rotating bits

2006-05-27 Thread Florian Klaempfl
[EMAIL PROTECTED] wrote:
> 
>> Michael Van Canneyt wrote:
> 
>>Well, if we're going in that direction anyway:
>>Why not include all possible assembler instructions then ?
>>
>>Let's be serious. You must draw the line somewhere.
>>I think these instructions are so exotic, they are pollution of the
> system unit.
>  
> I agree with Michael. And I think the line is clearly drawn. The FPC
> (and more importantly the language syntax itself) design goal, as I
> understand it, is to be, as much as possible, platform and architecture
> independent and doesn't need to be "polluted" by adding esoteric
> functions/(worst yet)operators becuase they are neat on one particular
> type of machine and we just program around them everywhere else.

This conclusion is drawn on wrong assumptions: the rot instructions
aren't esoteric but supported by at least the four most important CPU
platforms (i386, x86_64, powerpc and arm) and needed for efficient
cryptographic and graphics algorithms.

> Rather, if your application really needs that function, you have
> a number of suggestions on how to implement that within your own
> application, so do that, but I don't think the compiler should be
> expected to do it for you.

I didn't saw usable suggestions for non i386 platforms :)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] rotating bits

2006-05-27 Thread Bisma Jayadi
I agree with Michael. And I think the line is clearly drawn. The FPC  (and 
more importantly the language syntax itself) design goal, as I understand it, 
is to be, as much as possible, platform and architecture independent and 


I believe the bit rotation support can be made platform and architecture 
indepedent. This operation obviously needed regardless the platform or the 
architecture. It is very important for calculation algorithms and the 
implementation (e.g. simulation, graphics, encoding, math, etc) and that's why 
it IS available almost on all modern architectures. Is there any 
platform/architecture that does not require or provide this operation?


doesn't need to be "polluted" by adding esoteric functions/(worst yet)operators 
becuase they are neat on one particular type of machine and we just program 
around them everywhere else.


As function it'll pollute pascal syntax, but not if it is as operator. And 
clearly the bit rotation operation is not esoteric. It's just like the reason 
why shl/shr operator exist. Make rol/ror as operator even make FPC syntax more 
clear and clean. If shl/shr can exist as operator, then why ror/rol can't? Of 
course, I also can be on contra side for the shl/shr operator if I want... with 
the exact reasons as yours. :)


Rather, if your application really needs that function, you have a number of 
suggestions on how to implement that within your own application, so do 
that, but I don't think the compiler should be expected to do it for you. 


The problem is... almost everyone need it. Even the compiler itself! Like what 
Florian has told us in this thread. :)


-Bee-

has Bee.ography at
http://beeography.wordpress.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Trim repeated whitespace from a string

2006-05-27 Thread Michael Van Canneyt


On Fri, 26 May 2006, Graeme Geldenhuys wrote:

> Hi,

Anybody know of a function that can remove (normalize) a string by
remove all beginning and ending whitespace as well as replace all
repeated spaces with a single space.  A bonus would be to remove tabs
and newlines chars as well, but that is not so important.

Example:
Before:   "  This is what itshouldlook like. "
After:   "This is what it should look like."

Use Trim from sysutils and then DelSpace1 from strutils.

http://www.freepascal.org/docs-html/rtl/strutils/delspace1.html

It might be a good idea to look at

http://www.freepascal.org/docs-html/rtl/strutils/index-5.html

Just so you know what is in store...

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Trim repeated whitespace from a string

2006-05-27 Thread Graeme Geldenhuys

Hi,


On 5/27/06, Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

Use Trim from sysutils and then DelSpace1 from strutils.

http://www.freepascal.org/docs-html/rtl/strutils/delspace1.html

It might be a good idea to look at

http://www.freepascal.org/docs-html/rtl/strutils/index-5.html

Just so you know what is in store...

Michael.



Before all the replies, I managed to create my own custom function.  I
never knew about DelSpace1 or the StrUtils unit. Thanks everybody!  I
will go have a look at StrUtils unit and improve my own code if
needed.


Regards,
 Graeme.



--
There's no place like 127.0.0.1
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-27 Thread L505

> On 27 May 2006, at 09:46, Arne Hanssen wrote:
>
> >>   setlength(last3, 3);
> >>   last3[1]:= filename[length(filename)-2];
> >>   last3[2]:= filename[length(filename)-1];
> >>   last3[3]:= filename[length(filename)];
> >
> > As already explained, you must tell 'last3' its length.  As you
> > already
> > are using a somewhat "lowlevel" approach, you could replace the state-
> > ment 'setlength(last3, 3);' with 'last3[0]:=chr(3);'.
>
> Note that the setlength will generate exactly the same code as the
> 'last3[0]:=chr(3);' statement, so it's better to keep the setlength
> (in case the string would ever become an ansistring, or just for
> readability)

I didn't think the compiler would let you access string[0] directly anyway, 
even with
range checking off - since that's a compiler thing - but I haven't checked for 
sure.
(using i:=0; string[i] could work but calling setlength is fine for me for this 
purpose).

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal