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

2006-05-26 Thread Jeff Pohlmeyer
Anybody know of a function that can remove (normalize) a string by remove all beginning and ending whitespace uses SysUtils; S:=Trim(S); as well as replace all repeated spaces with a single space. uses StrUtils; S:=DelSpace1(S); A bonus would be to remove tabs and newlines chars as well

Re: [fpc-pascal] rotating bits

2006-05-26 Thread Bisma Jayadi
a := b ror c; x := y rol z; It would wreck havoc with typing. What should the result be of "1 ror 1"? $80? $8000? $8000? $8000? $8000 on 32 bit and $8000 on 64 bit cpus? I believe the compiler knows the datatype and make an appropriate rotate action based o

Re: [fpc-pascal] rotating bits

2006-05-26 Thread Bisma Jayadi
> Adding new operators is much more work and error prone than Agree. I never made a compiler, and I hope I won't, nor interested. :D I did make a simple SQL engine, though. AFAIK, adding a new operator, especially when a "similar" operator has existed before, wouldn't be too difficult. But, I

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

2006-05-26 Thread Felipe Monteiro de Carvalho
On 5/26/06, Cox, Stuart TRAN:EX <[EMAIL PROTECTED]> wrote: The __CvtStr function used the _REM_LEAD_WHITE_STR + _REM_TRAIL_WHITE_STR For this you can just use the Trim function. + _REDUCE_WHITE_STR This looks easy to implement. You can just create your own function for this. for i := 0 to

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

2006-05-26 Thread Cox, Stuart TRAN:EX
Blaise Computing's "Power Tools Plus" offered just such a function in their Unit_Str unit. The __CvtStr function used the _REM_LEAD_WHITE_STR + _REM_TRAIL_WHITE_STR + _REDUCE_WHITE_STR combination of constants to achieve what you'd like to do. I have the full source to all their units, but, as th

Re: [fpc-pascal] unit name with dots

2006-05-26 Thread Michael Van Canneyt
On Thu, 25 May 2006, mariano podesta wrote: > > > > > > This looks to me like a delphi bug. > > > a bug? are you serious? > > A unit must be a valid pascal > > > > identifier. > > > fpc just support valid standard pascal? this is not what i heard. > delphi7 supports it since 2002. not a .net rel

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-26 Thread Jonas Maebe
On 26 May 2006, at 19:35, L505 wrote: The length bytes of those shortstrings aren't initialised if you don't do setlength(). It has nothing to do with memory allocation, but with initialisation. Learn something new today - I unfortunately don't have a turbopascal background and in this case

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-26 Thread L505
> > var > > filename: string; > > last3: string[3]; > > last4: string[4]; > > > this is not short strings > use > last3: shortstring[3]; In delphi 5 and FPC in objfpc mode it doesn't accept that. ___ fpc-pascal maillist - fpc-pascal@lists.fre

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-26 Thread L505
> > I'm lacking some memory concept here. Below program doesn't work > > unless setlengths > > are called first on the shortstrings. > > > > program Project1; > > > > {$mode objfpc}{$H+} > > > > var > > filename: string; > > last3: string[3]; > > last4: string[4]; > > begin > > filename:= '

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-26 Thread Jonas Maebe
On 26 May 2006, at 14:10, L505 wrote: I'm lacking some memory concept here. Below program doesn't work unless setlengths are called first on the shortstrings. program Project1; {$mode objfpc}{$H+} var filename: string; last3: string[3]; last4: string[4]; begin filename:= 'test';

Re: [fpc-pascal] assigning ansistring with shortstring

2006-05-26 Thread DarekM
L505 napisaƂ(a): I'm lacking some memory concept here. Below program doesn't work unless setlengths are called first on the shortstrings. program Project1; {$mode objfpc}{$H+} var filename: string; last3: string[3]; last4: string[4]; this is not short strings use last3: shortstring[

Re: [fpc-pascal] rotating bits

2006-05-26 Thread Jonas Maebe
On 26 May 2006, at 16:36, Bisma Jayadi wrote: Agree! Since these are very important and relatively commonly used, I think it'd be better if they're implemented as new operators ("ror" and "rol") rather than as functions. Say we'll able to code like this: a := b ror c; x := y rol z; Just

Re: [fpc-pascal] rotating bits

2006-05-26 Thread Florian Klaempfl
Bisma Jayadi wrote: >> That's the point why I want to include compiler support: rol/ror is very >> important for several cryptographic algorithms. > > Agree! Since these are very important and relatively commonly used, I > think it'd be better if they're implemented as new operators ("ror" and > "

Re: [fpc-pascal] unit name with dots

2006-05-26 Thread Florian Klaempfl
mariano podesta wrote: > > > This looks to me like a delphi bug. > > > a bug? are you serious? Of course, asdf.asdf is no valid pascal identifier. > > A unit must be a valid pascal > > > identifier. > > > fpc just support valid standard pascal? this is not what i heard. > delphi

Re: [fpc-pascal] rotating bits

2006-05-26 Thread Bisma Jayadi
That's the point why I want to include compiler support: rol/ror is very important for several cryptographic algorithms. Agree! Since these are very important and relatively commonly used, I think it'd be better if they're implemented as new operators ("ror" and "rol") rather than as functions

[fpc-pascal] Trim repeated whitespace from a string

2006-05-26 Thread Graeme Geldenhuys
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

[fpc-pascal] assigning ansistring with shortstring

2006-05-26 Thread L505
I'm lacking some memory concept here. Below program doesn't work unless setlengths are called first on the shortstrings. program Project1; {$mode objfpc}{$H+} var filename: string; last3: string[3]; last4: string[4]; begin filename:= 'test'; filename:= filename+ 'ing.pas'; setlength

[fpc-pascal] GNU/Linux sql tool

2006-05-26 Thread Graeme Geldenhuys
Hi, Does anybody know of a decent (even a half decent one will do) sql tool for GNU/Linux that can connect to a Firebird database. By that I mean one that I can write and execute sql statements. I don't need a DB admin (create tables, etc) as I do that manually via scripts. I have been using is

Re: [fpc-pascal] unit name with dots

2006-05-26 Thread mariano podesta
> > This looks to me like a delphi bug.a bug? are you serious? A unit must be a valid pascal> > identifier. fpc just support valid standard pascal? this is not what i heard. delphi7 supports it since 2002. not a .net release. Or is there any use in supporting this?ofcourse there is a use.you see