Re: [fpc-pascal]TStringList.indexOf (case-sensitivity)

2003-08-27 Thread Michael Van Canneyt


On Wed, 27 Aug 2003, James Mills wrote:

> Hi,
>
> Is TStringList.indexOf case sensitive or insensitive ?
> TStrings.indexOf is case insensitive, but TStringList.indexOf overrides
> the TStrings.indexOf implementation accoriding to the documentation.

It is case insensitive, but this was changed recently for Delphi
compatibility.
Older versions are case sensitive. Here are the relevant log entries:

revision 1.15
date: 2003/05/29 23:13:57;  author: michael;  state: Exp;  lines: +5 -2
fixed case insensitivity of TStrings.IndexOf

revision 1.14
date: 2002/12/10 21:05:44;  author: michael;  state: Exp;  lines: +12 -5
+ IndexOfName is case insensitive


Michael.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Two Questions

2003-08-27 Thread Olle Raab
> 
> On Sat, 23 Aug 2003, Luis Del Aguila wrote:
> 
>> Two questions
>> 
>> 1.- What is the difference with seekeoln() and eoln() functions?
> 
> The first advances the file position to the end of the line.
> The second returns true if the current position is the end of the line.
> 
>> 2.- What is the difference with seekeof() and eof() functions?
> 
> Same as 1, only for end of file instead of end of line.
> 
> This is described in the documentation.
> 
> Michael.
> 

The documentation (below) doesn't seem to corresponds entirelly to what you
write above. That is it doesnt go unconditionally to the end of file...

Which is the most correct description of the function ?


> Declaration: 
>
> Function SeekEof [(Var F : text)] : Boolean;
>
> Description: 
>
> SeekEof returns True is the file-pointer is at the end of the file. It ignores
> all whitespace. Calling this function has the effect that the file-position is
> advanced until the first non-whitespace character or the end-of-file marker is
> reached. If the end-of-file marker is reached, True is returned. Otherwise,
> False is returned. If the parameter F is omitted, standard Input is assumed.


Olle


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]TStringList.indexOf (case-sensitivity)

2003-08-27 Thread James Mills
On Wed, Aug 27, 2003 at 09:39:10AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Wed, 27 Aug 2003, James Mills wrote:
> 
> > Hi,
> >
> > Is TStringList.indexOf case sensitive or insensitive ?
> > TStrings.indexOf is case insensitive, but TStringList.indexOf overrides
> > the TStrings.indexOf implementation accoriding to the documentation.
> 
> It is case insensitive, but this was changed recently for Delphi
> compatibility.
> Older versions are case sensitive. Here are the relevant log entries:
> 
> revision 1.15
> date: 2003/05/29 23:13:57;  author: michael;  state: Exp;  lines: +5 -2
> fixed case insensitivity of TStrings.IndexOf
> 
> revision 1.14
> date: 2002/12/10 21:05:44;  author: michael;  state: Exp;  lines: +12 -5
> + IndexOfName is case insensitive
> 

Is there no other function that searches the list in a case insensitive
way ? I've been looking through the current FCL source and speaking to a
member of the list...

It seems perhaps I should write a descendant of TStringList, which I've
done and works for my purpose.

The other query I have with TStringList, is the sqlite unit uses
CommaText which replaces " with "" and other side affects you don't want
in an IRC Services application. I'm going to have a find a way around
this too. I've solved the problem of null values and quoted string
returns from sqlite by a simple algorithm check.

function TDatabase.simpleQuery(query: String): String;
var
   tmp:  String;
begin
   if NOT (SQL = nil) then
  begin
 SQL.Query(query, nil);
 if (SQL.List_Field.count > 0) then
begin
   S := TStringList(SQL.List_Field.items[0]);
   tmp := S.Strings[0];
   if (tmp[1] = '"') AND (tmp[length(tmp)] = '"') then
  begin
 if ((length(tmp) - 2) = 0) then
begin
   simpleQuery := '';
end
 else
begin
   (* tmp := copy(tmp, 2, (length(tmp) - 1)); *)
   tmp := copy(tmp, 2, length(tmp));
   tmp := copy(tmp, 1, (length(tmp) - 1));
   simpleQuery := tmp;
end;
  end
   else
  begin
 simpleQuery := tmp;
  end;
end
 else
begin
   simpleQuery := '';
end;
  end;
end;

This works for what I need.

cheers
James

> 
> Michael.
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
-Zero Defect Software Engineers Group - ZDSEG
-
-You need only two tools. WD-40 and duct tape.
-If it doesn't move and it should, use WD-40.
-If it moves and shouldn't, use the tape.

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]TStringList.indexOf (case-sensitivity)

2003-08-27 Thread Michael Van Canneyt


On Wed, 27 Aug 2003, James Mills wrote:

> On Wed, Aug 27, 2003 at 09:39:10AM +0200, Michael Van Canneyt wrote:
> >
> >
> > On Wed, 27 Aug 2003, James Mills wrote:
> >
> > > Hi,
> > >
> > > Is TStringList.indexOf case sensitive or insensitive ?
> > > TStrings.indexOf is case insensitive, but TStringList.indexOf overrides
> > > the TStrings.indexOf implementation accoriding to the documentation.
> >
> > It is case insensitive, but this was changed recently for Delphi
> > compatibility.
> > Older versions are case sensitive. Here are the relevant log entries:
> >
> > revision 1.15
> > date: 2003/05/29 23:13:57;  author: michael;  state: Exp;  lines: +5 -2
> > fixed case insensitivity of TStrings.IndexOf
> > 
> > revision 1.14
> > date: 2002/12/10 21:05:44;  author: michael;  state: Exp;  lines: +12 -5
> > + IndexOfName is case insensitive
> > 
>
> Is there no other function that searches the list in a case insensitive
> way ? I've been looking through the current FCL source and speaking to a
> member of the list...

No. IndexOf() is meant to search the list. In D7, there is a property
'CaseSensitive' which determines whether the search is performed case
sensitively or not...

>
> It seems perhaps I should write a descendant of TStringList, which I've
> done and works for my purpose.

This is always possible, that is why we have OOP.

>
> The other query I have with TStringList, is the sqlite unit uses
> CommaText which replaces " with "" and other side affects you don't want
> in an IRC Services application.

Then you don't need commatext, but plain old 'text'.
The idea of commatext is exactly that it replaces " with ""...

Michael.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]Reading in image files...

2003-08-27 Thread Rainer Hantsch
Hello!

I would like to read in image files into my command line program on LINUX
_without_ doing all the low level stuff by hands. I would like to use some
shared libraries for that.

Because I have absolutely no knowledge about how to write a program which uses
such libraries, how to load it, how to interface it,..., I want to ask if
somebody has a _working_ example code.


mfg

  Ing. Rainer Hantsch


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Reading in image files...

2003-08-27 Thread Michael Van Canneyt


On Wed, 27 Aug 2003, Rainer Hantsch wrote:

> Hello!
>
> I would like to read in image files into my command line program on LINUX
> _without_ doing all the low level stuff by hands. I would like to use some
> shared libraries for that.
>
> Because I have absolutely no knowledge about how to write a program which uses
> such libraries, how to load it, how to interface it,..., I want to ask if
> somebody has a _working_ example code.

Only if you are prepared to use classes.

Michael.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Reading in image files...

2003-08-27 Thread Rainer Hantsch
On Wed, 27 Aug 2003, Michael Van Canneyt wrote:
| Only if you are prepared to use classes.
|
| Michael.

=8-(

Ok, so I will have to use them... :-(

Does fpc 1.0.4 have everything installed what is required, or must I add a lot
of things to make it working? I remember that I had always problems with
installing all this stuff...


mfg

  Ing. Rainer Hantsch


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Reading in image files...

2003-08-27 Thread Michael Van Canneyt


On Wed, 27 Aug 2003, Rainer Hantsch wrote:

> On Wed, 27 Aug 2003, Michael Van Canneyt wrote:
> | Only if you are prepared to use classes.
> |
> | Michael.
>
> =8-(
>
> Ok, so I will have to use them... :-(
>
> Does fpc 1.0.4 have everything installed what is required, or must I add a lot
> of things to make it working? I remember that I had always problems with
> installing all this stuff...

No, you need fpc 1.0.10.

Michael.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]2 questions on ansistrings

2003-08-27 Thread Mark Emerson
1. If a segment is deleted from an ansistring, e.g. ...

s := 'abcdefghijklmnop';
delete (s, 5, 6);

yielding s = 'abcdelmnop'

...does the system "shift" the 'lmnop' to the left, or does the string
get hooked together with pointers, thus saving much time with long strings?

2. Is there any documentation yet of the ansistring internals?  If not,
what file contains the source?

Thanks,
Mark

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]2 questions on ansistrings

2003-08-27 Thread Michael Van Canneyt


On Wed, 27 Aug 2003, Mark Emerson wrote:

> 1. If a segment is deleted from an ansistring, e.g. ...
>
> s := 'abcdefghijklmnop';
> delete (s, 5, 6);
>
> yielding s = 'abcdelmnop'
>
> ...does the system "shift" the 'lmnop' to the left, or does the string
> get hooked together with pointers, thus saving much time with long strings?

It is shifted. Hooked together would maybe make 'delete' faster, but
would considerably slow down other operations.

But the memory is not reallocated in this case, unless the string had a
reference count of 2.

And the shift is done using a 'Move' instruction, which is highly
optimized.

>
> 2. Is there any documentation yet of the ansistring internals?  If not,
> what file contains the source?

The memory layout is documented in the programmer's guide:

Memory Issues
 + Data Formats
   + String types
 + Ansistring types

The source is rtl/inc/astrings.inc

Michael.

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]Something of a mystery....

2003-08-27 Thread L D Blake
Ok guys I've got something of a mystery going on at this end and I sure could
use some suggestions...

My system:  Amd 1800xp, 256mb ram, gigabyte motherboard, TNT 64 video, no
overclocks or other "enhancements"...  Wind2000 sp4 with free pascal on it's
own partition.

I'm working on a piece of software here that uses some MCI calls as part of
it's secondary functions. If I start it playing a song then put it into the
background it will play the song perfectly, but the rest of the window goes
strange on me... When it comes back to foreground the title bars are missing
from all the application's windows and from any window I open through the
software (open file dialog, for example). If I try to move one of the
application windows it will draw the frame of one of the application's other
windows in the top left of the screen and all the menu context numbers for the
buttons etc pop up onto the display. Moving the main window around will result
in it drawing the frames of all the other windows, one at a time in the upper
left of the screen. These images are not active, they just pop up and
disappear depending on the location of the main window. Sometimes it grabs
bits of other application wndows and draws them in random locations on the
screen... But... so long as I never put the application into the background it
will work perfectly for hours on end.

I compiled it with stack checking and range checking turned on, no errors.  I
tried debug mode through the FP-IDE, no errors.  I've tried setting memory and
stack sizes, which makes no difference.  I also tried re-declaring all my
variables using the Win-api syntax, same problem.

I'm stumped... HELP!

-
 L D Blake


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal