Re: [fpc-pascal]ProceList/Quote Program (ncurses)

2004-07-12 Thread James Mills
On Mon, Jul 12, 2004 at 09:51:18AM +0200, Marco van de Voort wrote:
> > Am I better off writing my own classes using the ncurses library ?
> 
> IMHO only if you make something small. TV allows the most rich textmode
> apps I know. Problem is that it might require some debugging here and there,
> but that will pay itself back on a larger project. Specially if you have
> no gigantic requirements on terminal independance.

I might do this then since this is only a small Terminal app, and I
might learn a few things along the way :)

cheers
James

-- 
-ShortCircuit Services
-WIKI: http://wiki.shortcircuit.net.au
-IRC: http://wiki.shortcircuit.net.au/IRC/
-IRC: (/server shortcircuit.net.au)
-
-"Problems are Solved by Method"
-
-Team123 - We deliver
-URL: http://team123.shortcircuit.net.au

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


Re: [fpc-pascal]ProceList/Quote Program (ncurses)

2004-07-12 Thread James Mills
On Mon, Jul 12, 2004 at 09:11:57AM +0200, Marco van de Voort wrote:
> Libraries: Turbo Vision. (see the textmode IDE). It only uses the terminfo
> part of ncurses though, which improves look and feel, but decreases terminal
> independance.

Am I better off writing my own classes using the ncurses library ? vs.
Learning Turbo Vision which I've never used...

Is Turbo Vision more complicated than ncurses ?

cheers
James

-- 
-ShortCircuit Services
-WIKI: http://wiki.shortcircuit.net.au
-IRC: http://wiki.shortcircuit.net.au/IRC/
-IRC: (/server shortcircuit.net.au)
-
-"Problems are Solved by Method"
-
-Team123 - We deliver
-URL: http://team123.shortcircuit.net.au

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


[fpc-pascal]ProceList/Quote Program (ncurses)

2004-07-11 Thread James Mills
Hi,

I'm intending upon writing a program to help with developing quotes for
computer systems with the price list given in CSV then converted to a
RDBMS of some sort (eg: sqlite).

My intention is to build this program using the ncurses library and
develop a set of interfaces that are easy to use.

Q: Is there anything out there that'll make it easier to design the
windows/screen ?

Q: Has anyone written a similar program that I can learn from ?

cheers
James

-- 
-ShortCircuit Services
-WIKI: http://wiki.shortcircuit.net.au
-IRC: http://wiki.shortcircuit.net.au/IRC/
-IRC: (/server shortcircuit.net.au)
-
-"Problems are Solved by Method"
-
-Team123 - We deliver
-URL: http://team123.shortcircuit.net.au

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


Re: [fpc-pascal]FPC Version 1.9.4 released.

2004-06-02 Thread James Mills
On Wed, Jun 02, 2004 at 03:40:38PM +0200, Michael Van Canneyt wrote:
> > And PIC (Position Independant Code) generation is working too ?
> 
> No. See the roadmap: scheduled for 1.9.6

Excuse me ignorance. I don't beleive I know what PIC is... What is PIC ?

cheers
James

-- 
-ShortCircuit Services
-WIKI: http://wiki.shortcircuit.net.au
-IRC: http://wiki.shortcircuit.net.au/IRC/
-IRC: (/server shortcircuit.net.au)
-
-"Problems are Solved by Method"
-
-Team123 - We deliver
-URL: http://team123.shortcircuit.net.au

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


[fpc-pascal]Developers needed (interested?)

2004-03-14 Thread James Mills
Hi,

We (currently two people, myself a uni student doing Software
Engineering and Jeremy a great graphics designer) are planning on
developing a multi-player strategy game. Based on some games we've all
known to love and hate, but simple enough to have fun!

We are at early stages of designing and will need further people to help
out with various phases of the project. This is entirely voluntary, and
any support we receive will be appreciated.

This game will of course be released into the Open Source community.

For further information please visit the temporary wiki namespace
created at http://wiki.shortcircuit.net.au/SAF/
The current name is temporary only and may change...

If you would like to help out and join the project team, please email
either:
James Mills (myself) -> [EMAIL PROTECTED]
or
Jeremy Whyatt -> [EMAIL PROTECTED]

Thank you for taking an interest :)

cheers
James

-- 
-
-ShortCircuit Services
-WIKI: http://wiki.shortcircuit.net.au
-IRC: http://wiki.shortcircuit.net.au/IRC/
-IRC: (/server shortcircuit.net.au)
-
-"Problems are Solved by Method"

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


Re: [fpc-pascal]quick question

2004-03-04 Thread James Mills
On Thu, Mar 04, 2004 at 11:39:46PM -0500, r.w.h wrote:
> begin
> if exists ('bot.log')
> then begin
> assign(ftb,'bot.log');
> append(ftb);
> writeln(ftb,'bot log created'); // find away to enter time , date
> close(ftb);
> end
> else
> begin
> assign(ftb,'bot.log');
> reset(ftb);
> writeln(ftb,'the botlog was created');
> close(ftb);
> end;
> end;
> 
> whats wrong with the code.
> i get the following error on compile.
> botlog.pp(25,4) Error: Identifier not found "exists"

Try: FileExists

cheers
James

-- 
-
-ShortCircuit Services
-URL: http://www.shortcircuit.net.au
-WIKI: http://wiki.shortcircuit.net.au
-
-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]How to daemonize a program?

2004-01-11 Thread James Mills
On Sun, Jan 11, 2004 at 07:06:35PM -0500, Paul Aviles wrote:
> Hello all,
> 
> I know I can start a program with & at the end and will run in the
> background. Is there a way to do this without the & symbol in Linux?

have a look at the daemon.pp example in the examples.

cheers
James

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


Re: [fpc-pascal]Info about the compiler

2004-01-10 Thread James Mills
On Sat, Jan 10, 2004 at 01:32:18PM +0100, Marco van de Voort wrote:
> > Freepascal compiler can compile for 32 bits real mode??
> 
> Yes

I was just thinking about FPC being used to write a small kernel again,
I know it's been talked about before in threads in the past but the
whole process of doing it is very complicated and I was never able to do
it.

Are there better examples or documentation of how it's done now ? Could
someone perhaps explain how to do it ?

cheers
James

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


Re: [fpc-pascal]replacing BEGIN and END?

2004-01-08 Thread James Mills
On Wed, Jan 07, 2004 at 09:41:35PM -0800, Laurent Cocea wrote:
> Hi all-
> 
> Do you guys think there might be a way, either at this time or in the
> near future, to replace `BEGIN' with `{' and `END' with `}' in FPC code,
> and still be able to successfully compile it? Thanks.

Definately not! This is what makes C look so damn ugly.

cheers
James

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


Re: [fpc-pascal]gpm library compiled by default ?

2003-10-24 Thread James Mills
On Fri, Oct 24, 2003 at 07:59:56AM +0200, Michalis Kamburelis wrote:
> From your answer I understand that you are recompiling Keyboard unit 
> with -dNOMOUSE, which is pointless. I wrote (maybe it was not clear 
> enough, sorry) that you should recompile _Mouse_ unit (not Keyboard unit).
> 
> If this is not the case and you're doing as I said (recompiling Mouse 
> unit), you should make sure that you're really linking your program with 
> the newly compiled Mouse unit. E.g. you can check this by adding a small 
> Writeln('something...') to initialization section of Mouse unit or by 
> compiling with -vu.
> 
> If you're 100% sure that you're compiling your program with Mouse unit 
> that does not require Gpm unit than it means that some other unit uses 
> Gpm unit (I assume here that there is no other unit that links to libgpm 
> library directly, without using Gpm unit). There is not such unit in FPC 
> 1.0.10 RTL, but that doesn't mean anything... So in this case you should 
> use Peter Vreman's advice and recompile program with -vu to see what 
> other unit uses Gpm unit.

Ok I was a tad bit confused. You originally said to recompile the RTL,
which I don't really want to do anyway, and I don't have the sources to
recompile. I'll just stick with the main stream version :)

People that use my console programs are just gonna have to have the gpm
library installed now aren't they :)

cheers
James

-- 
-Zero Defect Software Engineers Group - ZDSEG
-
-Web:  http://daisy.ods.org/
-Wiki: http://daisy.ods.org/~prologic/wiki/
-ICQ:  9663
-
-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]gpm library compiled by default ?

2003-10-23 Thread James Mills
On Thu, Oct 23, 2003 at 09:16:19AM +0200, Marco van de Voort wrote:
> > On Wed, Oct 22, 2003 at 10:53:51PM +0200, Michalis Kamburelis wrote:
> > > Maybe you're using the Keyboard unit ? This unit uses Mouse in it's
> > > implementation, and by default unit Mouse uses Gpm unit (that links to
> > > libgpm). If you don't want to depend on libgpm you can recompile Mouse
> > > with symbol NOGPM defined (or even with NOMOUSE defined since you don't
> > > use mouse at all).
> > 
> > I think I do use the KeyBoard unit. So I could compile it with fpc
> > -dNOMOUSE ?
> 
> Yes. Under FreeBSD this is default even.

Compiling with this option makes no difference. It will still compile
and require the gpm library.

Any other suggestion ? IHMO, A console app that just uses the KeyBoard
should not need the gpm library in it's binary :)

cheers
James

-- 
-Zero Defect Software Engineers Group - ZDSEG
-
-Web:  http://daisy.ods.org/
-Wiki: http://daisy.ods.org/~prologic/wiki/
-ICQ:  9663
-
-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]gpm library compiled by default ?

2003-10-22 Thread James Mills
On Wed, Oct 22, 2003 at 10:53:51PM +0200, Michalis Kamburelis wrote:
> Maybe you're using the Keyboard unit ? This unit uses Mouse in it's
> implementation, and by default unit Mouse uses Gpm unit (that links to
> libgpm). If you don't want to depend on libgpm you can recompile Mouse
> with symbol NOGPM defined (or even with NOMOUSE defined since you don't
> use mouse at all).

I think I do use the KeyBoard unit. So I could compile it with fpc
-dNOMOUSE ?

cheers
James

-- 
-Zero Defect Software Engineers Group - ZDSEG
-
-Web:  http://daisy.ods.org/
-Wiki: http://daisy.ods.org/~prologic/wiki/
-ICQ:  9663
-
-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


[fpc-pascal]gpm library compiled by default ?

2003-10-22 Thread James Mills
Hi,

I noticed the other day that one of my FPC programs which does not in
anyway shape or form use the gpm or any mouse libraries actually
requires the gpm library to be installed.

It seems the fpc 1.0.10 is compiling programs and requiring libgpm to be
installed.

Why is this ?

cheers
James

-- 
-Zero Defect Software Engineers Group - ZDSEG
-
-Web:  http://daisy.ods.org/
-Wiki: http://daisy.ods.org/~prologic/wiki/
-ICQ:  9663
-
-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]GTK: multiline label

2003-10-09 Thread James Mills
On Thu, Oct 09, 2003 at 06:59:41AM -0700, Gene Buckle wrote:
> > Hello
> >
> > How ist possible to make initialize in fpc a multiline label. Something like
> >
> > Lbl := gtk_label_new('Line1 \n Line2');
> >
> > I guess but with what do I have to replace the "\n" ?
> >
> > Thank's for any help
> >
> 
> Would gtk_label_new('Line1' + #13 + 'Line2'); work?

Probably only for Linux/Unix

cheers
James

-- 
-
-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]Cross-Compiling Debian/Linux -> FreeBSD

2003-10-08 Thread James Mills
On Wed, Oct 08, 2003 at 11:02:45AM +0200, Marco van de Voort wrote:
> 
> > Is there an easy way of cross-compiling other than what I"m currently
> > doing (using a shell account), to cross-compile from Debian/Linux to
> > FreeBSD ?
> 
> There are certainly ways, and you are in luck, I just did this last weekend.
> I'm writing an article about it for a German magazine, and am very
> interested how doable it is for a  common user.
> 
> It is not hard. I generated linux and freebsd binaries on windows
> 
> Some questions first:
> - Is your binary pure FPC, or does it link to C? If it links to C libraries
>it goes out of my area of expertise.
Hrm,, unfortunately, it does use the SQLite library (www.sqlite.org). Is
it possible to link the library in the binary or do something else ?

In any case, if it's not possible at all with your current knowledge,
I'd like to know how it's done anyway for a pure FPC program :)

> - do you use 1.0.x or 1.1.x (I did it with 1.1.x, but 1.0.x is capable of it too)
>  
Free Pascal Compiler version 1.0.10 [2003/08/18] for i386
Copyright (c) 1993-2003 by Florian Klaempfl

> > If there is, I will need a step-by-step instruction, as I've never done
> > it before without the need for a different machine.
> 
> Let's make the shopping list first:
> 
> You'll need 
> - crossbinutils (from ftp see below)
> - a FreeBSD set of units matching the one you already have for linux.
> 
> Retrieving and installation
> ---
> 
> Crossbinutils linux->about 10 platforms are available from
> ftp://ftp.freepascal.org/fpc/contrib/cross/linux If this package is really
> to large (26M) because you are not on broadband, yell, and I'll isolate the
> FreeBSD ones from this package.
> 
> Besides this, you need two matching FPC versions, one for FreeBSD one for
> Linux. If you use a release, that is simple, just take the the freebsd
> release, more importantly the $PREFIX/lib/fpc/$VERSION/units/freebsd part.
> Put that in your FPC tree. (so in addition to
> $PREFIX/lib/fpc/$VERSION/units/linux you get also units/freebsd)
> (needs some manual extracting, and you don't need the FreeBSD binaries, just
> the compiled units tree)
>  
> Extract the cross libraries in a temp directory 
> and then go to the "bin" directory and get the i686-linux* files.
> 
> Rename them to remove the prefix (so as,ar,ld)
> 
> Put them in a directory (I'll use  /usr/local/cross/freebsd for the
> remainder of this post), and chmod +x them.
> 
> Editing fpc.cfg
> --
> 
> Make sure that all -Fu lines in your fpc.cfg don't specify units/linux/* at
> the end but change them to units/$TARGET/*  
> 
> Put all additional -Fu commands (for own libraries) under #ifdef linux
> 
> Also add a 
> 
> #ifdef freebsd
> -FD/usr/local/cross/freebsd
> #endif
> 
> For more info about this kind of tricks see the buildfaq, which is a good
> thing to read/have anyway if you are going to try crosscompiling.
> http://www.stack.nl/~marcov/buildfaq.pdf
> 
> The crosscompile
> ---
> 
> Make sure that all .o, .a and .ppu files are deleted from your build
> directory and all other include and unit paths in your source tree
> 
> Then type
> 
> ppc386 -Tfreebsd  mymainprogram
> 
> 
> 
> ___
> 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


[fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD

2003-10-07 Thread James Mills
Hi,

Is there an easy way of cross-compiling other than what I"m currently
doing (using a shell account), to cross-compile from Debian/Linux to
FreeBSD ?

If there is, I will need a step-by-step instruction, as I've never done
it before without the need for a different machine.

cheers
James

-- 
-
-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]Fast answers in the mailing list

2003-10-02 Thread James Mills
On Thu, Oct 02, 2003 at 07:50:15PM +0800, Andy Sy wrote:
> Woah... those answers sure are coming in fast!  Am I on
> IRC? :-)
When you have a good email client like 'mutt' and are online a lot of
the day, you can expect replies in (almost) real-time :) hehe

cheers
James

-- 
-
-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]CR / CRLF problem when redirecting to file

2003-09-14 Thread James Mills
On Sun, Sep 14, 2003 at 05:57:57PM +0200, Jonas Maebe wrote:
> 
> On zondag, sep 14, 2003, at 17:48 Europe/Brussels, John Coppens wrote:
> 
> >In Linux, when redirecting FPC output to a file, I found that after 25
> >lines, CR characters are being added, as if in DOS:
> >
> >program TestCR;
> >uses
> >  CRT;
> 
> That's because you are using the crt unit. The crt unit is only meant 
> for screen display, it has to use all sorts of tricks on a *nix console 
> (setting it to raw mode, for instance). That's why you get garbage if 
> you redirect it to a file.

In some of my programs I do NOT use the CRT unit but a similar thing
happens. Go figure :)

cheers
James

-- 
-
-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]CR / CRLF problem when redirecting to file

2003-09-14 Thread James Mills
On Sun, Sep 14, 2003 at 12:48:28PM -0300, John Coppens wrote:
> Hello all,
> 
> In Linux, when redirecting FPC output to a file, I found that after 25
> lines, CR characters are being added, as if in DOS:
> 
> program TestCR;
> uses
>   CRT;
> var
>   i: integer;
> begin
>   for i := 1 to 50 do
> writeln('The quick brown fox jumps over the lazy dog''s back ', i);
> end.
> 
> when doing a   ./testcr > testcr.txt
> 
> CR's appear on line 25 and after. (This seems to profoundly confuse some
> terminal windows, which change mode and have to be 'reset').

Yes this happens all the time when dealing with stdin and stdout with
FPC. I'm not sure why either :) Log files can sometimes get really ugly
with CRLF's appearing where they shouldn't be (seeing as it's linux not
msdos)

Perhaps it's a bug  ?

cheers
James

-- 
-
-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]CGI: cgiapp.pp and ezcgi.pp possible bug

2003-09-14 Thread James Mills
On Sun, Sep 14, 2003 at 05:36:25PM +0200, [EMAIL PROTECTED] wrote:
> 
> 
> On Mon, 15 Sep 2003, James Mills wrote:
> 
> > On Sun, Sep 14, 2003 at 06:48:36AM -0700, Alan Mead wrote:
> > > --- James Mills <[EMAIL PROTECTED]> wrote:
> > > >
> > > > It hands when you POST data with two angled bracked, eg: "> >"
> > > > I have not tried using GET, I don't think it would be appropiate
> > > > for a
> > > > form based page :)
> > >
> > > Form data can be POST'd or GET'd depending on the way you form the
> > > 'form' tag.  You're right that POST is generally used but sometimes
> > > the form data are brief and it's advantageous to allow the user to
> > > bookmark the state of the CGI, in which case you should use GET.
> > > Google and Yahoo searches are a good example.
> > >
> > > In this case, where you suspect a bug in processing of the data, it
> > > might be helpful to know whether it affects both cases.  Have you
> > > solved the issue or do you have a small example program?
> >
> > This bug is preventing me from completing a clone of my profressors
> > forum :P I will (when I find the time) try and implement an example to
> > show you.
> 
> I changed the form method to POST and retried, but it still works here.
> Are you sure the bug is not in your code ?
Positive :) It's based on an example in the FCL.
Would you like to take a look at it ? I'll gladly mail you the source,
it uses sqlite for it's embedded database.

cheers
James

-- 
-
-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]CGI: cgiapp.pp and ezcgi.pp possible bug

2003-09-14 Thread James Mills
On Sun, Sep 14, 2003 at 06:48:36AM -0700, Alan Mead wrote:
> --- James Mills <[EMAIL PROTECTED]> wrote:
> > 
> > It hands when you POST data with two angled bracked, eg: "> >"
> > I have not tried using GET, I don't think it would be appropiate
> > for a
> > form based page :)
> 
> Form data can be POST'd or GET'd depending on the way you form the
> 'form' tag.  You're right that POST is generally used but sometimes
> the form data are brief and it's advantageous to allow the user to
> bookmark the state of the CGI, in which case you should use GET. 
> Google and Yahoo searches are a good example.
> 
> In this case, where you suspect a bug in processing of the data, it
> might be helpful to know whether it affects both cases.  Have you
> solved the issue or do you have a small example program?

This bug is preventing me from completing a clone of my profressors
forum :P I will (when I find the time) try and implement an example to
show you.

cheers
James

-- 
-
-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]CGI: cgiapp.pp and ezcgi.pp possible bug

2003-09-13 Thread James Mills
On Sat, Sep 13, 2003 at 01:50:29AM -0700, Alan Mead wrote:
> I don't know anything about the FP cgi routines, but I program CGI a
> lot and the handling of characters like '>' could be tricky.  Does it
> hang on other strings containing an angle bracket, or just this
> particular one?  And you say when you POST... that means it works if
> you ... (I'm blanking on name of the other method)?

It hands when you POST data with two angled bracked, eg: "> >"
I have not tried using GET, I don't think it would be appropiate for a
form based page :)

cheers
James

-- 
-
-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]CGI: cgiapp.pp and ezcgi.pp possible bug

2003-09-12 Thread James Mills
On Fri, Sep 12, 2003 at 06:34:16PM +0200, [EMAIL PROTECTED] wrote:
> 
> 
> On Sat, 13 Sep 2003, James Mills wrote:
> 
> > Hi all again,
> >
> > I'm reposting this question as I would like to find some answers to this
> > problem, or writing this particular kind of CGI App will be impossible.
> > (Forum).
> >
> > I think there might be a possible bug in both ezcgi.pp and cgiapp.pp
> >
> > If you try and post a piece of form data:
> > ie:
> > 
> > > >
> > 
> >
> > it will hang in an infinite loop.
> 
> Not here. The testapplication also uses a textarea, and it works fine.

No what I mean is if you POST data to the cgi app containing "> >" it
will hang.

cheers
James

-- 
-
-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]CGI: cgiapp.pp and ezcgi.pp possible bug

2003-09-12 Thread James Mills
On Fri, Sep 12, 2003 at 11:09:28AM -0700, Alan Mead wrote:
> Is this something demonstrable in a small program?
I could rewrite another version of the cgi app with a simple html to
post data containing "> >". I'll try and do that tonight and post it.

cheers
James

-- 
-
-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


[fpc-pascal]CGI: cgiapp.pp and ezcgi.pp possible bug

2003-09-12 Thread James Mills
Hi all again,

I'm reposting this question as I would like to find some answers to this
problem, or writing this particular kind of CGI App will be impossible.
(Forum).

I think there might be a possible bug in both ezcgi.pp and cgiapp.pp

If you try and post a piece of form data:
ie:

> >


it will hang in an infinite loop.

I'm not sure where the problem is, debugging cgi apps is hard ;)

cheers
James

-- 
-
-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]EOF function

2003-09-11 Thread James Mills
On Thu, Sep 11, 2003 at 03:01:39PM +0200, Maciej ?aszcz wrote:
> On Thu, 11 Sep 2003, James Mills wrote:
> 
> > Hi,
> >
> > The following (attached) is a programming problem I've implemented.
> > Now I know the way I've done the EOF test is not correct, otherwise it
> > would not crash with a runtime error of 106.
> >
> > Could someone show me the correct way of reading from stdin until there
> > is no more input ?
> 
> Have you tried to change the read to readln? IMO you are reading EOLN to
> the integer.

Well if you look at the input file it containts:

1 2
3 5
100 200

... etc

Would you still be able to do: readLn(input, i, j); ?

cheers
James

-- 
-
-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


[fpc-pascal]EOF function

2003-09-11 Thread James Mills
Hi,

The following (attached) is a programming problem I've implemented.
Now I know the way I've done the EOF test is not correct, otherwise it
would not crash with a runtime error of 106.

Could someone show me the correct way of reading from stdin until there
is no more input ?

cheers
James

-- 
-
-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.
program cycle;

function isEven(n: longInt): Boolean;
begin
	if (n MOD 2 = 0) then
		begin
			isEven := TRUE;
		end
	else
		begin
			isEven := FALSE;
		end;
end;

function getCycle(n: longInt): longInt;
var
	c:	longInt;
begin
	c := 1;
	while NOT (n = 1) do
		begin
			if isEven(n) then
begin
	n := n DIV 2;
end
			else
begin
	n := n * 3 + 1;
end;
			inc(c);
		end;
	getCycle := c;
end;

function getMaxCycle(i: longInt; j: longInt): longInt;
var
	max:	longInt;
	x:		longInt;
	c:		longInt;
begin
	max := 0;
	for c := i to j do
		begin
			x := getCycle(c);
			if (x > max) then
begin
	max := x;
end;
		end;
	getMaxCycle := max;
end;

var
	i:	longInt;
	j:	longInt;
begin
	while NOT EOF do
		begin
			read(input, i, j);
			writeLn(getMaxCycle(i, j));
		end;
end.
1 10
100 200
201 210
900 1000


Re: [fpc-pascal]make files

2003-09-08 Thread James Mills
On Sun, Sep 07, 2003 at 04:30:39PM -0400, Frank W McCormick wrote:
> Hi all
> 
> Can someone give me a simple example of  a makefile suitable for just
> simple compiling of one file ? I am so used to running FPC
> from the command line that make is foreign to me. 

Catch!

cheers
James

-- 
-
-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.
psb=psb.pas

all: psb

psb: $(psb)
fpc $(psb)

debug: $(psb)
fpc -bl -gg $(psb)

clean:
rm -f *ppu* *.o psb *~


[fpc-pascal]cgiapp.pp and ezcgi.pp possible bug

2003-09-07 Thread James Mills
Hi,

I think there might be a possible bug in both ezcgi.pp and cgiapp.pp

If you try and post a piece of form data:
ie:

> >


it will hang in an infinite loop.

I'm not sure where the problem is, debugging cgi apps is hard ;)

cheers
James

-- 
-
-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


[fpc-pascal]SDL Library

2003-09-07 Thread James Mills
Hi,

What's the reccomended SDL library to use with FPC ?

With FPC 1.0.6 I used to use SDL4Freepascal-1.2.0.0.tar.gz by Daniel F
Moisset ...

Are there any further updates to SDL for use with FPC ?
I found Daniel's port of the SDL library very easy to use.

cheers
James

-- 
-
-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]Read from command line

2003-09-07 Thread James Mills
On Sun, Sep 07, 2003 at 09:43:32PM +1000, DONALD PEDDER wrote:
>Don't know if it's different in Linux, but in the DOS version at least
> you can use paramstr(1), paramstr(2), etc.
> 
> if (paramstr(1)='test') then writenln('you passed the parameter passing
> test')

It isn't any different on Linux:

paramCount   (returns the number of parameters passed to the program)
paramStr(i)  (returns the i'th parameter)

cheers
James

-- 
-
-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]thread

2003-09-02 Thread James Mills
On Tue, Sep 02, 2003 at 09:56:18AM +0200, Chemistry.rd wrote:
> From: Dancso Andras <[EMAIL PROTECTED]>
> Subject: thread
> 
> Question: How can I start a new thread from FreePascal under Win32?

I think it might be platform independent. If that's the case there's a
nice example in the FCL source. Not sure if there's an example in the
demos, might be :)

cheers
James

-- 
-
-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]ICS for FPC 1.1

2003-08-28 Thread James Mills
On Thu, Aug 28, 2003 at 04:09:12PM +0200, Michael Van Canneyt wrote:
> Synapse. It's on the contributed units list, I think.
If I remember correctly, this is what you guys had a huge mailing list
conversation about :P God knows what about though I couldn't follow it
after 2 follow ups :(

cheers
James

-- 
-
-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]Lazarus

2003-08-28 Thread James Mills
On Thu, Aug 28, 2003 at 04:08:44PM +0200, Marco van de Voort wrote:
> > The www.lazarus.freepascal.org has been down for a while, does anyone know
> > what exactly what happened?
> 
> Some hacker activity, and the owner wanted to reinstall to make sure that
> they were entirely gone.

That's so pathetic. What'd the hacker do anyhow ? And how the heck does
a hacker break into a *nix box ? (I assume it is...)

cheers
James

-- 
-
-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]ICS for FPC 1.1

2003-08-28 Thread James Mills
On Thu, Aug 28, 2003 at 01:51:41PM +0200, Marco van de Voort wrote:
> 
> After years of playing to get ICS running under FPC/win32, the 1.1.x
> compiler is finally getting so stable that the only remaining differences
> are minor ones. So minor, that the author of ICS has decided to merge them
> into the main distribution over time.
> 
> Currently FPC compiles the few console demoes (http, smtp, ftp and generic
> socket), and the units that belong to that (and a few more without demoes)
> 
> To use ICS, you need a 1.1 compiler of yesterday, and the ICS source tree.
> 
> The source tree is in CVS as projects/contrib/ics 
> 
> >From time to time I make CVS sources snapshots of ICS and put them on the
> ICS/FPC status page:
> 
> http://www.stack.nl/~marcov/ics.html

I've never even heard of ICS untill now :P I used to use Delphi 5 but
that was many years ago. I've used FPC ever since. Goes to show you how
much I know huh :P

What other internet suites are there besides ICS that can be used easily
with FPC ?

cheers
James

> 
> Marco
> 
> ___
> 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-28 Thread James Mills
On Thu, Aug 28, 2003 at 09:31:13AM +0200, Michael Van Canneyt wrote:
> 
> 
> In D7, yes. In FPC: Not unless you send me a patch :-)

Perhaps I will. It's rather a waste of code to create an entire
desandant :)

cheers
James

-- 
-
-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-28 Thread James Mills
On Wed, Aug 27, 2003 at 03:03:31PM +0200, Michael Van Canneyt wrote:
> 
> 
> 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...

I look at the source and didn't see a property like this. Maybe I'll
check again :)
So if I went, strings.CaseSensitive := True;
it'd work ?

> 
> >
> > 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 ""...
Well I've left the sqlite class to use commatext, but in my simple
database class have used nsiExtractQuotedStr to remove double quotes and
surrouding quotes in the string. using plain text adds extra 0A chars on
the end.

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 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


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

2003-08-26 Thread James Mills
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.

cheers
James

-- 
-
-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]Debugging FPC

2003-08-23 Thread James Mills
On Sat, Aug 23, 2003 at 05:39:49PM +0200, Peter Vreman wrote:
> You can leave the debian fpc packages installed and install an own
> compiled fpc version in /usr/local or in your home dir.
(hides from the maintainter), perhaps I should maintain the debian
package :)

James (hides!)

-- 
-
-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]Debugging FPC

2003-08-23 Thread James Mills
On Fri, Aug 22, 2003 at 04:51:27PM +0200, [EMAIL PROTECTED] wrote:
> Of course, I forgot that the RTL we distribute doesn't contain symbol
> information. Go to the rtl/linux sources directory (I don't know offhand
> where the sources are installed under Linux), type "make OPT="-g", and
> then compile your program with -Fu. Now it
> will link to an rtl with full debug information and you will be able to
> place breakpoints in the rtl.

A, now all is clear to me! lol.
I'm using Debian (sarge) and the source is not distributed with the FPC
packages.

It may look like I might have to remove all of FPC and compile and
install the whole thing myself to get all the features I need ;)
Any other Debian users on this mailing list with some advice ?

cheers
James

-- 
-
-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]Debugging FPC

2003-08-22 Thread James Mills
On Fri, Aug 22, 2003 at 03:14:20PM +0200, Peter Vreman wrote:
> You can use the gdb available in Debian. It has already the pascal support
> included.
(gdb) b HANDLEERRORFRAME
Function "HANDLEERRORFRAME" not defined.

It doesn't define whatever HANDLEERRORFRAME is though, so what Jonas
said won't work...

cheers
James

-- 
-
-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]Debugging FPC

2003-08-22 Thread James Mills
On Fri, Aug 22, 2003 at 10:35:15AM +0200, [EMAIL PROTECTED] wrote:
> 
> 
> gdbpas is included with fpc (all versions). gdb = GNU DeBugger. The "pas"
> stands for "with pascal extensions".
I do not seem to have this anywhere on my system. Of course I have gdb.
Can I get it somewhere ? (Perhaps the Debian maintainer didn't include
it in 1.0.6)

> PS: please only quote the part of the original mail that's necessary to
> understand the context.
nps, sorry, putting into practise now :)

-- 
-
-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]Debugging FPC

2003-08-22 Thread James Mills
On Fri, Aug 22, 2003 at 09:30:49AM +0200, [EMAIL PROTECTED] wrote:
> 
> 
> On Fri, 22 Aug 2003, James Mills wrote:
> 
> > > An unhandled exception occurred at 0x080A33B1 :
> > > List index exceeds bounds (-1)
> > >   0x080A33B1
> >
> > Also anyone out there, I'd really like to know if the above is possible
> > ... I have to find the source of this particular defect in 19,000 LOC.
> > All it tells me is an index out of bounds, which could mean a number of
> > things.
> 
> Load the program in gdbpas. Put a breakpoint on HandleErrorFrame (with the

what is gdbpas ? I'm using FPC 1.0.6 ...

cheers
James

> command "b HANDLEERRORFRAME", caps are important). You can set command
> line parameters using "set args para1 para2 ...". If not all of the
> sources are in one directory, you can add directories that gdbpas has to
> search sources in using "directory dir1;dir2;dir3;...".
> 
> Next, type "run". When the breakpoint is hit, type "bt" (backtrace).
> 
> 
> Jonas
> 
> 
> ___
> 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]Debugging FPC

2003-08-22 Thread James Mills
On Fri, Aug 22, 2003 at 11:08:14AM +1000, James Mills wrote:
> I think perhaps I need to repost my question as I saw the mailing list
> server go down yesterday...
> 
> Hi,
> 
> 1) Is there anyway of finding out the cooresponding source line when a
> program crashes and only outputs the following:
> 
> An unhandled exception occurred at 0x080A33B1 :
> List index exceeds bounds (-1)
>   0x080A33B1

Also anyone out there, I'd really like to know if the above is possible
... I have to find the source of this particular defect in 19,000 LOC.
All it tells me is an index out of bounds, which could mean a number of
things.

Thanks in advance

James

> 
> 2) With compile modes: -gg -gl
>Aren't line info and tracebacks suppose to be shown, the above
> example does not show these.
> 
> cheers
> James
> 
> -- 
> -
> -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

-- 
-
-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]RE: Debugging FPC

2003-08-22 Thread James Mills
On Thu, Aug 21, 2003 at 09:44:30PM -0700, Jeff Pohlmeyer wrote:
> > With compile modes: -gg -gl
> > Aren't line info and tracebacks suppose to be shown,
> > the above example does not show these.
> 
> 
> I think the problem comes with using exceptions. Normally, if a 
> run-time error occurs, the default exit proc will print the line
> number info to stdout. But if an exception traps the error before
> the program exits, then that information is absorbed by the 
> exception handler, and never makes it to the exit proc.

I do not have any exception handlers in my program though...
So how does it not show the line number info ?

cheers
James

> 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> 
> ___
> 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


[fpc-pascal]Debugging FPC

2003-08-21 Thread James Mills
I think perhaps I need to repost my question as I saw the mailing list
server go down yesterday...

Hi,

1) Is there anyway of finding out the cooresponding source line when a
program crashes and only outputs the following:

An unhandled exception occurred at 0x080A33B1 :
List index exceeds bounds (-1)
  0x080A33B1

2) With compile modes: -gg -gl
   Aren't line info and tracebacks suppose to be shown, the above
example does not show these.

cheers
James

-- 
-
-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


[fpc-pascal]Debuggin

2003-08-20 Thread James Mills
Hi,

1) Is there anyway of finding out the cooresponding source line when a
program crashes and only outputs the following:

An unhandled exception occurred at 0x080A33B1 :
List index exceeds bounds (-1)
  0x080A33B1

2) With compile modes: -gg -gl
   Aren't line info and tracebacks suppose to be shown, the above
example does not show these.

cheers
James

-- 
-
-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]QWord vs. function Abs

2003-08-20 Thread James Mills
On Wed, Aug 20, 2003 at 02:34:23PM +0200, [EMAIL PROTECTED] wrote:
> Hallo,
> i'm newbie and maybe making something wrong.
> 
> Small example for go32v2:
> 
> var q1,q2:qword;
> begin
>   q1:=10;
>   q2:=20;
>   writeln(Abs(q1-q2));
> end.

I get runtime 215 with FPC 1.0.6 ...

This probably means that FPC cannot support qwords in the abs function
even though the documentation says "Any numerical type".

Not sure though :)

cheers
James

> 
> With FPC compiler 1.0.10/IDE 0.9.2 i got this error message:
> 
> 'Can't determine which overloaded function to call'
> 
> Any idea ?
> 
> With type INT64,Word it is o.k.
> I think this version 1.0.x doesn't full support type QWord.
> 
> I want try the new version 1.1.x, but under Windows NT/SP6a (czech version)
> is not possible to start \pp\bin\go32v2\fp.exe.
> 
> Lubom?r ?abla
> 
> ___
> 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]SQLITE with FPC

2003-08-15 Thread James Mills
On Tue, Aug 12, 2003 at 09:12:37AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Tue, 12 Aug 2003, James Mills wrote:
> 
> > On Wed, Aug 06, 2003 at 07:18:33PM +0200, Jilani Khaldi wrote:
> > > Hi All,
> > > could someone point me where to find the sqlite.pas for FP to use with
> > > Linux Linux?
> > > Any hint or examples is welcome.
> > > jilani
> >
> > Let me know if you find a TDataSet class that'll work with FPC and
> > Sqlite on Linux. Cause I haven't yet... There are some around on
> > torry.net but they're for delphi using windows. I've asked the author if
> > he could convert it to FPC for linux but without much luck atm.
> 
> Can you point it out to me ? Normally it should compile as-is.

I've given up on finding a TDataset class that'll work with FPC and
SQLite. ;)

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]SQLITE with FPC

2003-08-14 Thread James Mills
On Wed, Aug 06, 2003 at 07:18:33PM +0200, Jilani Khaldi wrote:
> Hi All,
> could someone point me where to find the sqlite.pas for FP to use with 
> Linux Linux?
> Any hint or examples is welcome.
> jilani

Let me know if you find a TDataSet class that'll work with FPC and
Sqlite on Linux. Cause I haven't yet... There are some around on
torry.net but they're for delphi using windows. I've asked the author if
he could convert it to FPC for linux but without much luck atm.

I say this because you're going to run into pascal string problems like
I have.

cheers
James

> 
> ___
> 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]SQLITE with FPC

2003-08-14 Thread James Mills
On Wed, Aug 06, 2003 at 07:18:33PM +0200, Jilani Khaldi wrote:
> Hi All,
> could someone point me where to find the sqlite.pas for FP to use with 
> Linux Linux?

Excellent someone else that wishes to use sqlite with FPC :)
I'll attach all relevant sources... However a TDataset class still needs
to be written (although not 100% necessary). I can't write it though, no
knowledge of Datasets...

cheers
James

> Any hint or examples is welcome.
> jilani
> 
> ___
> 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.
{$mode objfpc}
unit sqlite;
interface

{
  Automatically converted by H2Pas 0.99.15 from sqlite.h
  The following command line parameters were used:
-S
-D
-p
-l
sqlite
sqlite.h
}

  const
External_library='sqlite'; {Setup as you need}

  { Pointers to basic pascal types, inserted by h2pas conversion program.}
  Type
PLongint  = ^Longint;
PSmallInt = ^SmallInt;
PByte = ^Byte;
PWord = ^Word;
PDWord= ^DWord;
PDouble   = ^Double;
PPPchar   = ^ppchar;

{$PACKRECORDS C}

const
  _SQLITE_VERSION = '2.8.3';
  SQLITE_ISO8859 = 1;

{$ifndef win32}
var
  sqlite_version  : pchar;cvar;external;
  sqlite_encoding : pchar;cvar;external;
{$endif}

const
  SQLITE_OK = 0;
  SQLITE_ERROR  = 1;
  SQLITE_INTERNAL   = 2;
  SQLITE_PERM   = 3;
  SQLITE_ABORT  = 4;
  SQLITE_BUSY   = 5;
  SQLITE_LOCKED = 6;
  SQLITE_NOMEM  = 7;
  SQLITE_READONLY   = 8;
  SQLITE_INTERRUPT  = 9;
  SQLITE_IOERR  = 10;
  SQLITE_CORRUPT= 11;
  SQLITE_NOTFOUND   = 12;
  SQLITE_FULL   = 13;
  SQLITE_CANTOPEN   = 14;
  SQLITE_PROTOCOL   = 15;
  SQLITE_EMPTY  = 16;
  SQLITE_SCHEMA = 17;
  SQLITE_TOOBIG = 18;
  SQLITE_CONSTRAINT = 19;
  SQLITE_MISMATCH   = 20;
  SQLITE_MISUSE = 21;
  SQLITE_NOLFS  = 22;
  SQLITE_AUTH   = 23;
  SQLITE_FORMAT = 24;
  SQLITE_ROW= 100;
  SQLITE_DONE   = 101;


  SQLITE_COPY= 0;
  SQLITE_CREATE_INDEX= 1;
  SQLITE_CREATE_TABLE= 2;
  SQLITE_CREATE_TEMP_INDEX   = 3;
  SQLITE_CREATE_TEMP_TABLE   = 4;
  SQLITE_CREATE_TEMP_TRIGGER = 5;
  SQLITE_CREATE_TEMP_VIEW= 6;
  SQLITE_CREATE_TRIGGER  = 7;
  SQLITE_CREATE_VIEW = 8;
  SQLITE_DELETE  = 9;
  SQLITE_DROP_INDEX  = 10;
  SQLITE_DROP_TABLE  = 11;
  SQLITE_DROP_TEMP_INDEX = 12;
  SQLITE_DROP_TEMP_TABLE = 13;
  SQLITE_DROP_TEMP_TRIGGER   = 14;
  SQLITE_DROP_TEMP_VIEW  = 15;
  SQLITE_DROP_TRIGGER= 16;
  SQLITE_DROP_VIEW   = 17;
  SQLITE_INSERT  = 18;
  SQLITE_PRAGMA  = 19;
  SQLITE_READ= 20;
  SQLITE_SELECT  = 21;
  SQLITE_TRANSACTION = 22;
  SQLITE_UPDATE  =  23;
  SQLITE_DENY= 1;
  SQLITE_IGNORE  = 2;

  SQLITE_NUMERIC = -1;
  SQLITE_TEXT= -2;
  SQLITE_ARGS= -3;

  
Type
  Psqlite = Pointer;
  Psqlite_vm = Pointer;
  PPsqlite_vm = ^Psqlite_vm;
  Psqlite_func = Pointer;
  
  // Procedural types used in functions.
  
  sqlite_callback = function (_para1:pointer; _para2:longint; _para3:PPchar; _para4:PPchar):longint;{$ifdef win32}cdecl{$else}cdecl{$endif};
  sqlite_trace_func = procedure (_para1:pointer; _para2:Pchar);{$ifdef win32}cdecl{$else}cdecl{$endif};
  sqlite_create_func = procedure (_para1:Psqlite_func; _para2:longint; _para3:PPchar);{$ifdef win32}cdecl{$else}cdecl{$endif};
  sqlite_handler = function (_para1:pointer; _para2:Pchar; _para3:longint):longint;{$ifdef win32}cdecl{$else}cdecl{$endif};
  sqlite_step_func = procedure (_para1:Psqlite_func; _para2:longint; _para3:PPchar)  ;{$ifdef win32}cdecl{$else}cdecl{$endif};
  sqlite_finalize_func = procedure (_para1:Psqlite_func);{$ifdef win32}cdecl{$else}cdecl{$endif};
  sqlite_authorize_func = function (_para1:pointer; _para2:longint; _para3, _para4,_para5,_para6:Pchar):longint;{$ifdef win32}cdecl{$else}cdecl{$endif};
  
  function sqlite_create_function(_para1:Psqlite; zName:Pchar; nArg:longint; xFunc:sqlite_create_func; pUserData:pointer):longint;{$ifdef win32}cdecl{$else}cdecl{$endif};external External_library name 'sqlite_create_function';
  function sqlite_open(filename:Pchar; mode:longint; errmsg:PPchar):Psqlite;{$ifdef win32}cdecl{$else}cdecl{$endif};external External_library name 'sqlite_open';
  procedure sqlite_close(_para1:Psqlite);{$ifdef win32}cdecl{$else}cdecl{$endif};external External_library name 'sqlite_close';
  function sqlite_exec(_para1:Psqlite; sql:Pchar; _para3:sqlite_callback; _para4:pointer; errmsg:PPchar):longint;{$ifdef win32}cdecl{$else}cdecl{$endif};external External_library name 'sqlite_exec';
  function sqlite_last_insert_rowid(_para1:Psqlite):longint;{$ifdef 

Re: [fpc-pascal]what Programming Environment : Editor & Debugger

2003-08-14 Thread James Mills
On Thu, Aug 07, 2003 at 12:32:59AM +0200, Stefan Becker wrote:
> dear Pascal'ers,
> 
> I've just searched the net and freepascal.org in the hope of finding some
> info on what and how to set up a working environment with linux.
> 
> So far I've done all my editing and debuging on a DOS machine with
> Borland 7.0 - and "just" recompiling my applications with freepascal
> for linux. 
> 
> I want to go to a pure linux environment - so now the question.
> 
> What editor or program should I use and work my way into?
> It would be nice to have a debugger also.  Is there any
> "finished" packages that I could use?
> 
> The FreePascal website talks about a "fp IDE" and I remember
> seeing it for DOS.  Does this exist for linux?  

vim is a nice text editor for sources and support pascal syntax
highlighting. I think there is an IDE for Linux though, you'll find it
on the Free Pascal website.

There's also Lazarus that'll you find as well which you can use. It's
similar in many ways to Delphi and can be used for all your development
and gui needs (though I have not used it yet).

As far as a debugger goes, simply use gdb.

cheers
James

> 
> 
> many thanks,
> 
> Stefan Becker
> 
> 
> 
> 
> ___
> 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]Error 216 with SDL

2003-08-04 Thread James Mills
On Mon, Aug 04, 2003 at 09:44:13PM +0200, Jonas Maebe wrote:
> 
> On maandag, aug 4, 2003, at 21:12 Europe/Brussels, Holger Peters wrote:
> 
> >I used SDL4FreePascal under Windows with FreePascal 1.0.6 and it 
> >worked fine. Now, I use RedHat 9.0 with FreePascal 1.0.10 and 
> >SDL4FreePascal doesn't work.
> >When I compile the demos, I get the runtime error 216 at the first 
> >SDLcommand.
> >
> >Is there a solution?
> 
> The problem may be that the SDL4FreePascal C-header translation was 
> done for an older version than what you have now, so that type and 
> function definitions are wrong now. There are two possible solutions:
> 
> a) install the same version of SDL on your system as what you were 
> using before
> b) translate the SDL headers of the new version to Pascal (or bug 
> someone else to do it :)

Thanks Jonas :) I was clueless :P

James

> 
> 
> Jonas
> 
> 
> ___
> 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]Error 216 with SDL

2003-08-04 Thread James Mills
On Mon, Aug 04, 2003 at 09:12:37PM +0200, Holger Peters wrote:
> Hi,
> 
> I used SDL4FreePascal under Windows with FreePascal 1.0.6 and it worked 
> fine. Now, I use RedHat 9.0 with FreePascal 1.0.10 and SDL4FreePascal 
> doesn't work.
> When I compile the demos, I get the runtime error 216 at the first 
> SDLcommand.

I used to get this runtime error a lot using FPC 1.0.6 running Debian...
I can't remember what the cause was though or the solution :P When I do
I'll let you know :)


> 
> Is there a solution?

All I can suggest is to debug the code, I believe the demos themselves
aren't that good.

cheers
James

> 
> 
> Holger
> 
> 
> 
> ___
> 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]Direct writes to console buffer

2003-08-03 Thread James Mills
On Sun, Aug 03, 2003 at 07:26:35AM -0700, Rich Pasco wrote:
> James Mills wrote:
> 
> > In addition, I suggest using SDL which will work for windows. SDL is
> > probably a much better approach than trying to directly access video
> > RAM. And to makes things easier for you, once you learn to use SDL, you
> > could write a wrapper module so you don't have to even rewrite your old
> > programs :)
> 
> What is SDL?  Where can I get documentation about it?  Google turned
> up Simple DirectMedia Layer -- http://www.libsdl.org/ -- is that what
> you meant?

Yes this is the SDL Library. There is also an FPC port of this library
(version 1.2.0.0). I cannot find the home page for it though, so if you
can't find it also, I'll mail it to you.
Also I don't think there are any suitable tutorials (The ones provided
in the FPC port aren't that great) for using SDL with
FPC except for the C documentation at the libsdl website and others you
may find.

cheers
James

> 
> It could also be Specification and Description Language --
> http://www.sdl-forum.org/SDL/ -- but that seems less likely.
Not this.

> 
>  - Rich
> 
> 
> 
> 
> ___
> 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]Direct writes to console buffer

2003-08-02 Thread James Mills
On Sun, Aug 03, 2003 at 02:52:57AM -0400, L D Blake wrote:
> In reply to your message of August 3, 2003
> 
> > I'm trying to port some old Turbo Pascal programs to Windows 32-bit
> > console utilities.  They write directly to the screen buffer, which in
> > the DOS world an array of Word starting at ptr(SegB800,0) (for a color
> > display) or ptr(SegB000,0) for a monochrome one.  Now, as Windows
> > console utilities, I don't suppose it's so easy to get a pointer to
> > the upper left corner of the console window, or is it?
> 
> There's an additional complication... ME, NT, 2000 and XP won't let you write
> directly to the screen memory.  You'll probably need to re-work the screen
> access to use the through-the-drivers approach unless you are only interested
> in having your stuff work on 95 and 98.

In addition, I suggest using SDL which will work for windows. SDL is
probably a much better approach than trying to directly access video
RAM. And to makes things easier for you, once you learn to use SDL, you
could write a wrapper module so you don't have to even rewrite your old
programs :)

cheers
James

> 
> -
>  L D Blake
> 
> 
> ___
> 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]Cross-Compiling

2003-08-02 Thread James Mills
On Fri, Aug 01, 2003 at 10:45:00PM +0300, Nikolay Nikolov wrote:
> James Mills wrote:
> 
> >How are you guys goins with crosscompiling ?
> >I'd like to be able to cross compile from Debian/Linux to various other
> >platforms... Or have you been crosscompiling the other way ?
> >
> First of all, you need binutils, compiled with support for the targets 
> you want. Get the source, read the docs, and enable the targets you 
> want, then compile it. It's C, so you need gcc environment.
> 
> http://www.gnu.org/directory/GNU/binutils.html
> 
> If you manage to compile the binutils successfully you should end up 
> having as, ld, strip, etc... that support your target os & cpu.
> 
> You could also try looking for some precompiled binaries of the 
> binutils, for the target you want.
> 
> After that you can do: ppc386 -Tyour_target_os 
> -FD/path_to_cross_binutils yourfile.pas
> 
> You also need the Free Pascal RTL (and other OS-specific units), you can 
> get them precompiled from the fpc website. They are part of the fpc 
> binary distribution for your target os.

Thank you for this information, I now have more of an insight of how
it's done :)

cheers
James

> 
> 
> 
> ... or you can compile them yourself using the fpc source, but that's 
> somewhat more complicated.
> 
> If you want to compile for another cpu (fpc 1.0.10 supports i386 and 
> m68k; fpc 1.1 currently supports i386, powerpc and sparc) then you 
> *must* compile the compiler. You can read the fpc docs, for compiling 
> the compiler... :)
> 
> IIRC it was something like "make CPU_TARGET=m68k" in the compiler dir 
> for the motorola 680x0 (ppc for powerpc, i386 for i386, sparc for sparc 
> :) )... You end up having a ppc68k executable. Then you go to the rtl 
> directory and compile the rtl using this new ppc68k "make PP=ppc68k 
> OPT=-FD/path_to_cross_binutils" Perhaps you also need to add 
> OPT=-Tyour_target_os... I did it 2 weeks ago (I compiled a crosscompiler 
> for m68k amiga), and this is what I remember... There might be some 
> mistakes here... just read the docs, read the fpc compiler options and 
> play with it, until you get it working... :)
> 
> And you're done.
> 
> 
> ___
> 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


[fpc-pascal]Cross-Compiling

2003-08-01 Thread James Mills
Hi,

How are you guys goins with crosscompiling ?
I'd like to be able to cross compile from Debian/Linux to various other
platforms... Or have you been crosscompiling the other way ?

Anyone attempted to write a howto/tutorial yet ?

cheers
James

-- 
-
-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]runtime 201 with swapword function

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 04:36:39PM +0100, Matt Emson wrote:
> 
> 
> Doesn't  system contain a routine called 'swap' that does this exact thing??
> 
> This program would seem to work in both Delphi and FPC1.1:
> 
> program test;
> {$APPTYPE CONSOLE}
> 
> uses
>   sysutils;
> 
> var
>   i, j: word;
> begin
>   i := $9988;
>   writeln( IntToHex(i, 4) ); //output '9988'
>   j := swap( i );
>   writeln( IntToHex(j, 4)); //output '8899'
>   readln;
> end.
> 
> No need to go to the trouble of writing your won routine!! ;-)

I didn't write it, one of the FPC developers did last year in the
mailing list :)

cheers
James

> 
> Matt
> 
> 
> > Hi,
> >
> > Why does the following result in a runtime error ?
> >
> > program example;
> >
> > const
> > THE_PORT = ;
> >
> > function swapWord(w: Word): Word;
> > begin
> > swapWord := (w SHL 8) OR (w SHR 8);
> > end;
> >
> > var
> > port: Word;
> > begin
> > port := swapWord(THE_PORT)
> > end.
> >
> > $ ./swapword
> > Runtime error 201 at 0x08052AA2
> >   0x08052AA2
> >   0x08052AC2
> >   0x080480B0
> >
> >
> > cheers
> > James
> >
> > --
> > -
> > -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
> >
> 
> 
> 
> ___
> 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]How to use Linux libraries?

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 06:18:48PM +0200, Rainer Hantsch wrote:
> Hello, James!
> 
> On Sat, 26 Jul 2003, James Mills wrote:
> | I could write you up a set of such procedures or classes to do this,
> | however I'm starting back at uni. New semester :)
> 
> Good success at Uni! What are you studying?

Bachelor of Engineering in Software Engineering at Griffith University
(Australia, QLD)

> 
> 
> | Anyway, I'm sure there are others here on this mailing list that could
> | do the same.
> Possibly, yes. But you are the _first_ one who answered, so the number of
> people still seems to be very small... ;-)
> 
> 
> | Question: Why can't you do it yourself ? It isn't that hard to grab the
> | specs of the JPEG image format and learn it and write your own data
> | structures to contain the jpeg image data, decode it into pixel arrays...
> | It's all there in the specs :)
> 
> Something about me: I started programming in Pascal roughly 15 years ago, on
> CP/M (Z80 CPU, 4MB RAM, 10MB HDD,...), later I changed to DOS with finally
> Borland Pascal, but I kept consequently away from Windoze programming.
> Finally I changed to Linux, which is more what I like DOS, than Windoze...
> 
> But all this years I never wrote one line in assembly language, nor was there
> any need for me to include external code. I did everything in plain Pascal
> language, without any hacking and tweaking, which was perfect for writing all
> this userspecific software.
> 
> So my primary problem is that I never got experience about how to solve such
> things like linking to external libraries. Of course, I could sit down and
> hope to find it out by myself with trial & error, but this is extremely
> inefficient and time consuming. Also success will be very low in this case.
> Another thing is: Why should I start re-inventing the wheel and writing my own
> JPEG/TIFF/.../units from scratch, when there exist a lot of ready made
> libraries? Isn't it the purpose of libraries to do exactly this?
> 
> 
> So I am looking for some help in form of _working_ samples which I can analyze
> and try to understand. It will also be very helpful if there would be somebody
> who could "teach" me a little bit and guide me to my first success.

As you'll read in other posts just recently there are jpeg units for
pascal that do this. I probably have some myself that I'm unaware of :)

cheers
James

> 
> 
> 
> mfg
> 
>   Ing. Rainer Hantsch
> 
> 
> 
> ___
> 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]runtime 201 with swapword function

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 04:30:35PM +0200, Florian Klaempfl wrote:
> James Mills wrote:
> >On Fri, Jul 25, 2003 at 04:21:36PM +0200, Jonas Maebe wrote:
> >
> >>On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
> >>
> >>
> >>>Why does the following result in a runtime error ?
> >>>
> >>>program example;
> >>>
> >>>const
> >>>   THE_PORT = ;
> >>>
> >>>function swapWord(w: Word): Word;
> >>>begin
> >>>   swapWord := (w SHL 8) OR (w SHR 8);
> >>>end;
> >>
> >>In Pascal, all calculations are performed using the base type (which is 
> >>longint in FPC), so if w > 255, then w shl 8 > high(word) and will 
> >>result in a range check error when assigning to swapWord. Even if we 
> >>calculated everything using words, you'd still get an overflow error, 
> >>this time when doing the shl.
> >
> >
> >How can I correct this ?
> >This bit of code was taken directly from server.pp in one of the old
> >2002 mailing threads...
> 
> Turn range checking off for this piece of code or do
> 
> function swapWord(w: Word): Word;
>   begin
>  swapWord := ((w SHL 8) OR (w SHR 8)) and $;
>   end;

Least now I know the reason :)

cheers
James

> 
> 
> ___
> 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]runtime 201 with swapword function

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 04:30:24PM +0200, Jonas Maebe wrote:
> 
> On vrijdag, jul 25, 2003, at 16:32 Europe/Brussels, James Mills wrote:
> 
> >>In Pascal, all calculations are performed using the base type (which 
> >>is
> >>longint in FPC), so if w > 255, then w shl 8 > high(word) and will
> >>result in a range check error when assigning to swapWord. Even if we
> >>calculated everything using words, you'd still get an overflow error,
> >>this time when doing the shl.
> >
> >How can I correct this ?
> 
> Use a typecast:
> 
> function swapWord(w: Word): Word;
> begin
>   swapWord := Word((w SHL 8) OR (w SHR 8));
> end;

Excellent thank you :)

James

> 
> 
> Jonas
> 
> 
> ___
> 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]runtime 201 with swapword function

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 04:21:36PM +0200, Jonas Maebe wrote:
> 
> On vrijdag, jul 25, 2003, at 16:22 Europe/Brussels, James Mills wrote:
> 
> >Why does the following result in a runtime error ?
> >
> >program example;
> >
> >const
> > THE_PORT = ;
> >
> >function swapWord(w: Word): Word;
> >begin
> > swapWord := (w SHL 8) OR (w SHR 8);
> >end;
> 
> In Pascal, all calculations are performed using the base type (which is 
> longint in FPC), so if w > 255, then w shl 8 > high(word) and will 
> result in a range check error when assigning to swapWord. Even if we 
> calculated everything using words, you'd still get an overflow error, 
> this time when doing the shl.

How can I correct this ?
This bit of code was taken directly from server.pp in one of the old
2002 mailing threads...

cheers
James

> 
> 
> Jonas
> 
> 
> ___
> 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]How to use Linux libraries?

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 04:04:47PM +0200, Rainer Hantsch wrote:
> On Fri, 25 Jul 2003, Michael Van Canneyt wrote:
> | It uses some windows bitmap structures, and cannot be compiled on Linux as
> | is. For the rest it compiles 100% fine. You could cut&paste the needed
> | definitions from the windows unit and put them between {$ifndef
> | win32}..{$endif}
> 
> So, in fact, the whole 'pasjpeg' does not exist at all, because converting
> such a thing will require that knowledge which I currently do not have. The
> only way to learn from source code is to analyze a _working_ one. It makes no
> sense to analyze windows-dependent code when Linux code is (so I guess)
> nearely the opposite -- otherwise it would not be so complicated to port
> Windoze-Software to Linux...
> 
> 
> So I return to my initial question in the hope that somebody has already done
> such things...
> 
> What I need for my first steps, is some source code which compiles without any
> change on Linux and uses Linux' shared libraries for reading/writing data
> from/to image files in jpeg/gif/tif/... format.
> I definitely prefer procedural and/or OOP style before Delphi Style, because
> this is easier to understand and also matches better to my already existing
> code.
> 
> A good sample for doing first steps would be a program which reads a little
> JPEG image into RAM, hereby decoding it into a simple structure (i.e. an array
> of pixels, one for every color, so that I can get the RGB or CMYK values out
> easily for every pixel.
> Next step would be to store this structure back into a file.
> 
> With this two steps I can start. Nobody here who can help?

I could write you up a set of such procedures or classes to do this,
however I'm starting back at uni. New semester :)
Anyway, I'm sure there are others here on this mailing list that could
do the same.

Question: Why can't you do it yourself ?
It isn't that hard to grab the specs of the JPEG image format and learn
it and write your own data structures to contain the jpeg image data,
decode it into pixel arrays... It's all there in the specs :)

cheers
James

> 
> 
>   Ing. Rainer Hantsch
> 
> 
> 
> ___
> 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


[fpc-pascal]runtime 201 with swapword function

2003-07-25 Thread James Mills
Hi,

Why does the following result in a runtime error ?

program example;

const
THE_PORT = ;

function swapWord(w: Word): Word;
begin
swapWord := (w SHL 8) OR (w SHR 8);
end;

var
port:   Word;
begin
port := swapWord(THE_PORT)
end.

$ ./swapword 
Runtime error 201 at 0x08052AA2
  0x08052AA2
  0x08052AC2
  0x080480B0


cheers
James

-- 
-
-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]XChat plugins using FPC

2003-07-25 Thread James Mills
On Thu, Jul 24, 2003 at 11:17:53AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Thu, 24 Jul 2003, James Mills wrote:
> 
> > On Wed, Jul 23, 2003 at 08:50:35AM +0200, Michael Van Canneyt wrote:
> > >
> > >
> > > On Wed, 23 Jul 2003, James Mills wrote:
> > >
> > > > On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote:
> > > > > > I can successully compile and test the plugin source listed at
> > > > > > http://xchat.org/docs/plugin20.html written in C.
> > > > > >
> > > > > > However I don't like C much and am wondering if it's possible to do the
> > > > > > same thing in pascal... ? I know it has to be possible, but I need
> > > > > > someone to start me off in the right direction...
> > > > >
> > > > > Probably yes, but you'll need to convert headers of xchat-plugin.h. The
> > > > > "h2pas" util can be handy for this. (or at least it can save a lot of time)
> > > >
> > > > Okay I've converted the headers (step 1) :P
> > > >
> > > > $ h2pas -S -D -p -l xchat xchat-plugin.h
> > > > at line 6 error : syntax error
> > > > Illegal character in line 6
> > > > "#define XCHAT_IFACE_VERSION((XCHAT_IFACE_MAJOR * 1) + \"
> > > > at line 7 error : syntax error
> > > > Illegal character in line 7
> > > > "(XCHAT_IFACE_MINOR * 100) + \"
> > > >
> > > >
> > > >
> > > > What do I do with these errors though ?
> > >
> > > run the file through the gcc preprocessor:
> > >
> > > gcc -E xchat-plugin.h -o xchat-plugin.hp
> > > h2pas -S -D -p -l xchat xchat-plugin.hp
> > >
> > > Note that this destroys all '#define'  constants, so you'll have to
> > > run h2pas a second time to get all constants.
> > >
> > > Michael.
> > >
> > >
> > > ___
> > > fpc-pascal maillist  -  [EMAIL PROTECTED]
> > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >
> > I've sucessfully now done all this and now have the headers converted...
> > I have a problem though when trying to compiling a test plugin:
> >
> > $ fpc test
> > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386
> > Copyright (c) 1993-2002 by Florian Klaempfl
> > Target OS: Linux for i386
> > Compiling test.pas
> > Compiling xchatplugin.pas
> > xchatplugin.pas(49,24) Error: Identifier not found XCHAT_PLUGIN
> > xchatplugin.pas(49,36) Error: Error in type definition
> > xchatplugin.pas(50,22) Error: Identifier not found XCHAT_LIST
> > xchatplugin.pas(50,32) Error: Error in type definition
> > xchatplugin.pas(51,22) Error: Identifier not found XCHAT_HOOK
> > xchatplugin.pas(51,32) Error: Error in type definition
> > xchatplugin.pas(55,25) Error: Identifier not found XCHAT_CONTEXT
> > xchatplugin.pas(55,38) Error: Error in type definition
> > xchatplugin.pas(61,24) Error: Duplicate identifier _XCHAT_PLUGIN
> > xchatplugin.pas(61,24) Error: Duplicate identifier _XCHAT_PLUGIN
> > xchatplugin.pas(62,60) Error: Identifier not found PXCHAT_PLUGIN
> > xchatplugin.pas(62,96) Error: Type identifier expected
> > xchatplugin.pas(62,96) Fatal: Syntax error, ) expected but FUNCTION found
> >
> >
> > What's going on here ?
> 
> The unit is not correct. There are things that h2pas doesn't 'know'
> about. C is case sensitive. Pascal is not. so duplicate identifiers can
> exist. the C construct "xchat_plugin *" is translated to
> 'Pxchat_plugin', but that may or may not be defined already.
> 
> In general, a generated file may still need some manual editing before
> it is compilable. This is perfectly normal.

I'm a little confused as to what manual editing is necessary...
What about the:
  const
External_library='xchat'; {Setup as you need}

What does this need to be ?

Does the unit need to be linked with anything ? (There are no xchat
libraries I am aware of).

Help me out here :P (please)

cheers
James


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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]A suggestion.

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 10:33:19AM +0200, Jonas Maebe wrote:
> 
> On vrijdag, jul 25, 2003, at 08:30 Europe/Brussels, A.J. Venter wrote:
> 
> >I miss being able to put the cursor on a function/procedure/reserved
> >word name and hitting F1 to see the help section for it.
> 
> The text mode IDE already has support for this (using the html 
> documentation).

I use to use borland's turbo pascal ide once too, but I don't miss this
feature :) Nowadays vim suits be better

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]XChat plugins using FPC

2003-07-25 Thread James Mills
On Fri, Jul 25, 2003 at 01:04:14PM +0200, Holger Peters wrote:
> Hi,
> 
> if you are successful, I would be glad to receive the ported Header 
> files and a small example.

rofl! :) Make me do all the hard work :(
This is the first time I've converted any c headers of any sort... I'm
getting close though

I think I'll end up writing a unit interface to the c functions though.
I don't want to end up writing plugins and having to remember every
bloody xchat interface command :) do you ?

cheers
James

> 
> Holger
> 
> 
> James Mills schrieb:
> 
> >Hi,
> >
> >I can successully compile and test the plugin source listed at
> >http://xchat.org/docs/plugin20.html written in C.
> >
> >However I don't like C much and am wondering if it's possible to do the
> >same thing in pascal... ? I know it has to be possible, but I need
> >someone to start me off in the right direction...
> >
> >cheers
> >James
> > 
> >
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]XChat plugins using FPC

2003-07-24 Thread James Mills
On Wed, Jul 23, 2003 at 08:50:35AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Wed, 23 Jul 2003, James Mills wrote:
> 
> > On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote:
> > > > I can successully compile and test the plugin source listed at
> > > > http://xchat.org/docs/plugin20.html written in C.
> > > >
> > > > However I don't like C much and am wondering if it's possible to do the
> > > > same thing in pascal... ? I know it has to be possible, but I need
> > > > someone to start me off in the right direction...
> > >
> > > Probably yes, but you'll need to convert headers of xchat-plugin.h. The
> > > "h2pas" util can be handy for this. (or at least it can save a lot of time)
> >
> > Okay I've converted the headers (step 1) :P
> >
> > $ h2pas -S -D -p -l xchat xchat-plugin.h
> > at line 6 error : syntax error
> > Illegal character in line 6
> > "#define XCHAT_IFACE_VERSION((XCHAT_IFACE_MAJOR * 1) + \"
> > at line 7 error : syntax error
> > Illegal character in line 7
> > "(XCHAT_IFACE_MINOR * 100) + \"
> >
> >
> >
> > What do I do with these errors though ?
> 
> run the file through the gcc preprocessor:
> 
> gcc -E xchat-plugin.h -o xchat-plugin.hp
> h2pas -S -D -p -l xchat xchat-plugin.hp
> 
> Note that this destroys all '#define'  constants, so you'll have to
> run h2pas a second time to get all constants.
> 
> Michael.
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

I've sucessfully now done all this and now have the headers converted...
I have a problem though when trying to compiling a test plugin:

$ fpc test
Free Pascal Compiler version 1.0.6 [2002/08/10] for i386
Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pas
Compiling xchatplugin.pas
xchatplugin.pas(49,24) Error: Identifier not found XCHAT_PLUGIN
xchatplugin.pas(49,36) Error: Error in type definition
xchatplugin.pas(50,22) Error: Identifier not found XCHAT_LIST
xchatplugin.pas(50,32) Error: Error in type definition
xchatplugin.pas(51,22) Error: Identifier not found XCHAT_HOOK
xchatplugin.pas(51,32) Error: Error in type definition
xchatplugin.pas(55,25) Error: Identifier not found XCHAT_CONTEXT
xchatplugin.pas(55,38) Error: Error in type definition
xchatplugin.pas(61,24) Error: Duplicate identifier _XCHAT_PLUGIN
xchatplugin.pas(61,24) Error: Duplicate identifier _XCHAT_PLUGIN
xchatplugin.pas(62,60) Error: Identifier not found PXCHAT_PLUGIN
xchatplugin.pas(62,96) Error: Type identifier expected
xchatplugin.pas(62,96) Fatal: Syntax error, ) expected but FUNCTION found


What's going on here ?

cheers
James


-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]XChat plugins using FPC

2003-07-23 Thread James Mills
On Wed, Jul 23, 2003 at 08:51:10AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Wed, 23 Jul 2003, James Mills wrote:
> 
> > On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote:
> > > > I can successully compile and test the plugin source listed at
> > > > http://xchat.org/docs/plugin20.html written in C.
> > > >
> > > > However I don't like C much and am wondering if it's possible to do the
> > > > same thing in pascal... ? I know it has to be possible, but I need
> > > > someone to start me off in the right direction...
> > >
> > > Probably yes, but you'll need to convert headers of xchat-plugin.h. The
> > > "h2pas" util can be handy for this. (or at least it can save a lot of time)
> >
> > Now once these headers are converted...
> >
> > When writing the plugin source itself, do I need to use PChar's instead
> > of pascal strings ?
> 
> Your entry and exit points need that, yes. But all in between can be
> done using strings.

Kewl thanks :)

James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]XChat plugins using FPC

2003-07-23 Thread James Mills
On Wed, Jul 23, 2003 at 08:50:35AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Wed, 23 Jul 2003, James Mills wrote:
> 
> > On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote:
> > > > I can successully compile and test the plugin source listed at
> > > > http://xchat.org/docs/plugin20.html written in C.
> > > >
> > > > However I don't like C much and am wondering if it's possible to do the
> > > > same thing in pascal... ? I know it has to be possible, but I need
> > > > someone to start me off in the right direction...
> > >
> > > Probably yes, but you'll need to convert headers of xchat-plugin.h. The
> > > "h2pas" util can be handy for this. (or at least it can save a lot of time)
> >
> > Okay I've converted the headers (step 1) :P
> >
> > $ h2pas -S -D -p -l xchat xchat-plugin.h
> > at line 6 error : syntax error
> > Illegal character in line 6
> > "#define XCHAT_IFACE_VERSION((XCHAT_IFACE_MAJOR * 1) + \"
> > at line 7 error : syntax error
> > Illegal character in line 7
> > "(XCHAT_IFACE_MINOR * 100) + \"
> >
> >
> >
> > What do I do with these errors though ?
> 
> run the file through the gcc preprocessor:
> 
> gcc -E xchat-plugin.h -o xchat-plugin.hp
> h2pas -S -D -p -l xchat xchat-plugin.hp
> 
> Note that this destroys all '#define'  constants, so you'll have to
> run h2pas a second time to get all constants.

Okay, I'll try that :)

I tried fixing the header file, but obviously you know what to do better
than i :P

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]XChat plugins using FPC

2003-07-22 Thread James Mills
On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote:
> > I can successully compile and test the plugin source listed at
> > http://xchat.org/docs/plugin20.html written in C.
> > 
> > However I don't like C much and am wondering if it's possible to do the
> > same thing in pascal... ? I know it has to be possible, but I need
> > someone to start me off in the right direction...
> 
> Probably yes, but you'll need to convert headers of xchat-plugin.h. The
> "h2pas" util can be handy for this. (or at least it can save a lot of time)

Okay I've converted the headers (step 1) :P

$ h2pas -S -D -p -l xchat xchat-plugin.h 
at line 6 error : syntax error
Illegal character in line 6
"#define XCHAT_IFACE_VERSION((XCHAT_IFACE_MAJOR * 1) + \"
at line 7 error : syntax error
Illegal character in line 7
"(XCHAT_IFACE_MINOR * 100) + \"



What do I do with these errors though ?

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]XChat plugins using FPC

2003-07-22 Thread James Mills
On Wed, Jul 23, 2003 at 03:28:55AM +0200, Marco van de Voort wrote:
> > I can successully compile and test the plugin source listed at
> > http://xchat.org/docs/plugin20.html written in C.
> > 
> > However I don't like C much and am wondering if it's possible to do the
> > same thing in pascal... ? I know it has to be possible, but I need
> > someone to start me off in the right direction...
> 
> Probably yes, but you'll need to convert headers of xchat-plugin.h. The
> "h2pas" util can be handy for this. (or at least it can save a lot of time)

Now once these headers are converted...

When writing the plugin source itself, do I need to use PChar's instead
of pascal strings ?

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


[fpc-pascal]XChat plugins using FPC

2003-07-22 Thread James Mills
Hi,

I can successully compile and test the plugin source listed at
http://xchat.org/docs/plugin20.html written in C.

However I don't like C much and am wondering if it's possible to do the
same thing in pascal... ? I know it has to be possible, but I need
someone to start me off in the right direction...

cheers
James

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Synapse for FPC

2003-07-22 Thread James Mills
On Tue, Jul 22, 2003 at 09:28:12AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Tue, 22 Jul 2003, Marco van de Voort wrote:
> 
> > > > SNMP, NTP, SNTP, DNS, Syslog, FTP, TFTP, HTTP or LDAP protocols. You
> > > > can also use my MIME encoding and decoding engine, you can use my
> > > > charset transcoding engine... and lot of more stuffs. ;-)
> > > >
> > > > For more informations look to 'Ararat Synapse' web.
> > >
> > > Why should we use your set of classes vs. another set of classes
> > > developer by person X ? :)
> >
> > That's clear I think. It works with FPC :-)
> 
> Yes.
> 
> I've been cooperating to get it to work with FPC. It's one of the
> few suites that doesn't require threads and/or message pumps. So it was
> better suited to work with FPC, till we have sufficient support for
> threads and the like. (scheduled for 1.2)

Good :) The more FPC stuff out there the better I say, it's a bloody
beautifull compiler of a very nice old language!

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Synapse for FPC

2003-07-22 Thread James Mills
On Tue, Jul 22, 2003 at 10:36:54AM +0200, Lukas Gebauer wrote:
> > Why should we use your set of classes vs. another set of classes
> > developer by person X ? :)
> >
> > Just a friendly question, I know there are a lot of TCP/IP suites
> > around...
> 
> Why? It is not simple question. ;-)
> 
> Before a five years I need socket library for Delphi. In this time exists
> only two good libraries.. ICS (but it is using asynchronous sockets) and
> Winshoes (now it is called Indy). Yes, exists other libraries, but only
> this will be freeware and opensource!
> 
> For my purposes indy looks good. but it is components. You must do lot of
> things for install them to your system, etc. Indy is very huge and slow
> library. And on mostly places it is very badly written. ;-(
> 
> Rather then using it I wrote my own library based only on units with non-
> visual classes. It not need instalation, only add my unit to your 'uses'
> and go! When my fiend from Delphree association see my work, then tell
> me: "get your library for public, it is great!" Synapse was born!
> 
> By some years I create simple and fast implementation for lot of commonly
> used protocols. Synapse is not only one of TCP/IP libraries, this is
> technology leader. ;-) Yes, for example, Indy using lot of code based on
> my Synapse now! Synapse is first free and opensource library with
> solutions for email with automatic translating of charsets, Synapse is
> first free library with native SNMP implementation, Synapse is first free
> library with 'instant' IPv6 support, Synapse is first free library with
> native LDAP client, etc.
> 
> Yes 'First free' in delphi world! But on FPC world I not see comparable
> TCP/IP library. Really lot of people asking me: "Exists Synapse for FPC?"
> 
> FPC world now can use five years experience with Synapse from delphi
> world. ;-)

You've convinced me :)

Thanks for creating this suite...

cheers
James

> 
> --
> Lukas Gebauer.
> 
> E-mail: [EMAIL PROTECTED]
> WEB: http://www.ararat.cz/synapse - Synapse Delphi and Kylix TCP/IP
> Library
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Synapse for FPC

2003-07-21 Thread James Mills
On Mon, Jul 21, 2003 at 09:39:38AM +0200, Lukas Gebauer wrote:
> Hello FPC community!
> 
> Today I release new version of my 'Ararat Synapse'. (rel. 32)
> 
> What it is?
> 'Ararat Synapse' is TCP/IP library for Delphi, C++Builder and Kylix.
> Now it is for FreePascal too! It can be used for Wn32 systems and for
> Linux systems too.
> 
> Synapse is set of non-visual classes and procedures for TCP/IP
> programming. (IPv4 and IPv6 protocols is supported).
> 
> Additionally you can use my implementations of SMTP, POP3, IMAP4,
> SNMP, NTP, SNTP, DNS, Syslog, FTP, TFTP, HTTP or LDAP protocols. You
> can also use my MIME encoding and decoding engine, you can use my
> charset transcoding engine... and lot of more stuffs. ;-)
> 
> For more informations look to 'Ararat Synapse' web.

Why should we use your set of classes vs. another set of classes
developer by person X ? :)

Just a friendly question, I know there are a lot of TCP/IP suites
around...

cheers
James

> 
> 
> 
> --
> Lukas Gebauer.
> 
> E-mail: [EMAIL PROTECTED]
> http://www.ararat.cz/synapse/ - Ararat Synapse - TCP/IP Lib.
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 09:41:11AM -0700, Alan Mead wrote:
> 
> --- James Mills <[EMAIL PROTECTED]> wrote:
> > 
> > Well the only bad thing is that it returns data where there should
> > be no
> > data. ie: '""' instead of the expected '', causing the program to
> > treat
> > '""' as if it were a real string.
> 
> 
> All the better.  The string '""' is unlikely to exists you your
> database naturally, right?  So when you see it, you have a NULL.
That's correct. What I've learnt over the past 2 days though is that
I'll be leave blinded by all this unless I go pickup a book on database
and read it! :)

> 
> Or you could, as you suggested earlier, just convert it to an empty
> string.
I might do that if I have no luck with a TDataset desendant...

Thanks Alan,

James

> 
> -Alan
> 
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Re: SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 09:26:29AM -0700, Jeff Pohlmeyer wrote:
> 
> > like you could arrange for NULL results to be returned as the string 
> > value 'NULL' but then you would be unable to distinguish between 
> > actual strings with the value 'NULL' and the NULL result...
> 
> Just a thought, but maybe you could return 
> the single-character string: #0

Thanks mate :) I'm so lost anyway, all these people with much deeper
knowledge of databases...

cheers
James

> 
> 
> 
> 
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 08:53:12AM -0700, Alan Mead wrote:
> 
> --- James Mills <[EMAIL PROTECTED]> wrote:
> > On Tue, Jul 15, 2003 at 08:35:44AM -0700, Alan Mead wrote:
> > > 
> > > --- James Mills <[EMAIL PROTECTED]> wrote:
> > > 
> > > > My program relies on the fact that some fields (which are
> > string
> > > > types)
> > > > are null. I'm not sure what to say next so I'll leave it at
> > that :P
> > > 
> > > If your database never contains an empty string, then your
> > program
> > > can rely on the empty strings you retrieve being NULL values in
> > the
> > > database.
> > 
> > This case is true and the database will never contain empty strings
> > only
> > NULL values. The program has strict ways of doing this, unless of
> > course
> > you modify the databases externally, then bam (you're right as per
> > below)...
> 
> So if you do nothing, your program will work unless someone accesses
> the database externally (or there is a bug in whatever code ensures
> against inserting empty strings).  You need to decide how likely and
> bad that is.

Well the only bad thing is that it returns data where there should be no
data. ie: '""' instead of the expected '', causing the program to treat
'""' as if it were a real string.

James

> 
> But maybe there is a simple work-around.  Surely you can execute SQL
> select statements using SQLite, right?  If so, then you can exploit
> the fact that SQL itself is well aware of the distinction between
> empty strings and NULL's to check for this error condition.  
> 
> If you're checking one table called MYTABLE with a key called IDX and
> a couple fields to check are ADDRESS1 and ADDRESS2 then you would
> execute this select:
> 
> select IDX from MYTABLE where ADDRESS1='' or ADDRESS2=''
> 
> If you get no results, then there is no error condition (you can
> safely assume empty strings are NULL's).  If you get any results,
> then you know which records need to be fixed.
> 
> You could execute this query at the start of your application's run. 
> Or you could run it periodically (e.g., nightly) and email yourself
> the results.
> 
> -Alan
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 08:35:44AM -0700, Alan Mead wrote:
> 
> --- James Mills <[EMAIL PROTECTED]> wrote:
> 
> > My program relies on the fact that some fields (which are string
> > types)
> > are null. I'm not sure what to say next so I'll leave it at that :P
> 
> If your database never contains an empty string, then your program
> can rely on the empty strings you retrieve being NULL values in the
> database.

This case is true and the database will never contain empty strings only
NULL values. The program has strict ways of doing this, unless of course
you modify the databases externally, then bam (you're right as per
below)...

cheers
James

> 
> But if an empty string ever crept into a database field, then your
> program would think the field is null when it's not.  If this would
> cause a grevious error, then you should find a better way.
> 
> -Alan
> 
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 05:27:42PM +0200, Michael Van Canneyt wrote:
> 
> 
> On Wed, 16 Jul 2003, James Mills wrote:
> 
> > On Tue, Jul 15, 2003 at 07:04:05AM -0700, Alan Mead wrote:
> > >
> > > --- James Mills <[EMAIL PROTECTED]> wrote:
> > > > On Tue, Jul 15, 2003 at 04:36:24AM -0700, Alan Mead wrote:
> > > > >
> > > > > --- James Mills <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > > Just reconfirming with you and solidifying my knowledge.
> > > > > > The reason it returns "" is because: when working with
> > > > > > native pascal types, assigning null to a string results
> > > > > > in an empty string "" right ?
> > > > > >
> > > > > > cheers
> > > > > > James
> > > > >
> > > > > James,
> > > > >
> > > > > Pascal is a strongly typed language and there is no Pascal string
> > > > > precisely equivalent to a NULL.  Someone (either the SQLite
> > > > authors
> > > > > or the one who wrote the Pascal wrapper) decided to automatically
> > > > > translate NULL into empty (zero-length) strings.  And it's
> > > > impossible
> > > > > now to distinguish actual null values from fields containing
> > > > actual
> > > > > zero-length strings.
> > > >
> > > > I think I'm slowly understanding this bit now. I don't claim to be
> > > > an
> > > > SQL expert. But SQL (sqlite anyway) is capable of storing any data
> > > > types, strings, integers, boolean etc, including NULL values. I
> > > > hope I'm
> > > > correct here...
> > >
> > > I know nothing specifically about SQLite but SQL has many data types,
> > > similar to Pascal.  However, SQL data fields can also have the value
> > > NULL which has no analog with Pascal data.  Pascal data types cannot
> > > simultaneously hold data and this non-data missing value code (unless
> > > you define some convention within your code... like you could arrange
> > > for NULL results to be returned as the string value 'NULL' but then
> > > you would be unable to distinguish between actual strings with the
> > > value 'NULL' and the NULL result... which may be no big deal).
> > >
> > > According to Michael, someone arranged for NULL values to be
> > > translated to empty strings, perhaps without even meaning to, because
> > > of how ansistrings act.. they are internally pointers and an empty
> > > string is represented as a nil pointer.
> > >
> > > I have no idea why this behavior would be different between Windows
> > > (?) and Linux. (in fact, are you sure it is?)
> > >
> > > > Why could I not simply check for '""' in my sql return functions
> > > > and
> > > > simply return '' instead (a pascal empty string) ? Would this be
> > > > terribly wrong ?
> > >
> > > See below.
> > >
> > > > Or am I still going to have to follow Michael's
> > > > suggestion in finding a TDataset desendant ? (I don't understand
> > > > what a
> > > > TDataset desendant really is and why I need to use one but
> > > > anyway...)
> > >
> > > I think the idea with the TDataset was to create a record in Pascal
> > > that could hold all the SQL data. Since a string alone cannot hold
> > > it, you need a record with a string and a boolean.  The boolean holds
> > > NULL or not-NULL.  When the boolean holds not-NULL, the string holds
> > > the data (the string should never hold data if the boolean hold
> > > NULL).  By "boolean holds NULL", of course, I mean that you define
> > > the boolean in some way so that it indicates the NULL-ness.  For
> > > example, define it as 'IsNull:boolean;' and then TRUE will indicate
> > > that the result is NULL.
> >
> > Why did Michael say that creating a TDataset was so hard ? If in it's
> > simplest form it's just a record to hold the data with a boolean
> > indicating it's null-ness, that doesn't seem so difficult to implement
> > to me.
> 
> It is not that, it's much more than that. TDataset manages such
> 'records' and much more.
> 
> You can write whole books about the TDataset class and it's descendents.
> I wouldn't advise someone with no experience with TDatasets to start
> writing a descendent.

You obviously know a lot about this topic as I've seen in the mysql
dataset you created and the generic dataset. I've looked at it and
shaken my head! (I'll admit I don't know a lot about databases, but am
learning, SQL is my only knowledge thus far).

Having said that though, I'm going to try and modify Eric Jourde's
sqlite unit to accomadate for NULLs (try being the operative word :P)

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 07:04:05AM -0700, Alan Mead wrote:
> 
> --- James Mills <[EMAIL PROTECTED]> wrote:
> > On Tue, Jul 15, 2003 at 04:36:24AM -0700, Alan Mead wrote:
> > > 
> > > --- James Mills <[EMAIL PROTECTED]> wrote:
> > > 
> > > > Just reconfirming with you and solidifying my knowledge. 
> > > > The reason it returns "" is because: when working with 
> > > > native pascal types, assigning null to a string results 
> > > > in an empty string "" right ?
> > > > 
> > > > cheers
> > > > James
> > > 
> > > James,
> > > 
> > > Pascal is a strongly typed language and there is no Pascal string
> > > precisely equivalent to a NULL.  Someone (either the SQLite
> > authors
> > > or the one who wrote the Pascal wrapper) decided to automatically
> > > translate NULL into empty (zero-length) strings.  And it's
> > impossible
> > > now to distinguish actual null values from fields containing
> > actual
> > > zero-length strings.  
> > 
> > I think I'm slowly understanding this bit now. I don't claim to be
> > an
> > SQL expert. But SQL (sqlite anyway) is capable of storing any data
> > types, strings, integers, boolean etc, including NULL values. I
> > hope I'm
> > correct here...
> 
> I know nothing specifically about SQLite but SQL has many data types,
> similar to Pascal.  However, SQL data fields can also have the value
> NULL which has no analog with Pascal data.  Pascal data types cannot
> simultaneously hold data and this non-data missing value code (unless
> you define some convention within your code... like you could arrange
> for NULL results to be returned as the string value 'NULL' but then
> you would be unable to distinguish between actual strings with the
> value 'NULL' and the NULL result... which may be no big deal).
> 
> According to Michael, someone arranged for NULL values to be
> translated to empty strings, perhaps without even meaning to, because
> of how ansistrings act.. they are internally pointers and an empty
> string is represented as a nil pointer.  
> 
> I have no idea why this behavior would be different between Windows
> (?) and Linux. (in fact, are you sure it is?)  
> 
> > Why could I not simply check for '""' in my sql return functions
> > and
> > simply return '' instead (a pascal empty string) ? Would this be
> > terribly wrong ? 
> 
> See below.
> 
> > Or am I still going to have to follow Michael's
> > suggestion in finding a TDataset desendant ? (I don't understand
> > what a
> > TDataset desendant really is and why I need to use one but
> > anyway...)
> 
> I think the idea with the TDataset was to create a record in Pascal
> that could hold all the SQL data. Since a string alone cannot hold
> it, you need a record with a string and a boolean.  The boolean holds
> NULL or not-NULL.  When the boolean holds not-NULL, the string holds
> the data (the string should never hold data if the boolean hold
> NULL).  By "boolean holds NULL", of course, I mean that you define
> the boolean in some way so that it indicates the NULL-ness.  For
> example, define it as 'IsNull:boolean;' and then TRUE will indicate
> that the result is NULL.

Why did Michael say that creating a TDataset was so hard ? If in it's
simplest form it's just a record to hold the data with a boolean
indicating it's null-ness, that doesn't seem so difficult to implement
to me.

I might play around with the mysqldb.pp dataset class in the fcl source
though...

> 
> > > 3) you could simply avoid ever having empty strings in your
> > database
> > > (in which case, empty strings returned are always NULL's)
> > There should be no empty string in my database anyway. If a field
> > is
> > empty it's value is NULL.
> 
> Well then why are you worried about distinguishing between NULL's and
> empty strings?  All empty strings are NULL's.  (I know originally,
> you were compiling test programs... is this really an issue?) 

My program relies on the fact that some fields (which are string types)
are null. I'm not sure what to say next so I'll leave it at that :P

cheers
James

> 
> -Alan
> 
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Mon, Jul 14, 2003 at 03:39:36PM +0200, Michael Van Canneyt wrote:
> 
> 
> On Mon, 14 Jul 2003, James Mills wrote:
> 
> > On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> > >
> > >
> > > On Mon, 14 Jul 2003, James Mills wrote:
> > >
> > > > Hi,
> > > >
> > > > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > > > I'm not sure... I have been discussing this same problem on the SQLite
> > > > mailing list but without success there, so perhaps someone here might
> > > > know...
> > > >
> > > > I have attached a test database, which contains 1 database entry, null
> > > > strings are inserted using NULL... Check the database schema yourself.
> > > >
> > > > The problem therein lies in the fact that test3.pas returns "" for the
> > > > query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
> > > > It should return a null string as it does in test2.pas and in the sqlite
> > > > shell program.
> > >
> > > The problem is that an implicity conversion from Nil to empty string is
> > > done. You cannot solve this as long as stringlists are used to contain
> > > the data. (ok, you could set 'Null' as the string, but that is sloppy)
> > >
> > > You'd need to have (as a minimum) an array of TField records:
> > >   TField = Record
> > > IsNull : Boolean;
> > > Value : String;
> > >   end;
> > >
> > > But this will require major changes, so I suggest trying to find or
> > > implement a TDataset descendent for SQLIte, this will solve most of
> > > your problems at once.
> >
> > Where might I find such a descendent that using SQLite ? I'm not quite
> > sure what I'm looking for here... An initial search on google provides
> > some delphi units that are probably not what I'm looking for.
> 
> On the contrary, on Torry's pages there are some units that do exactly
> what I described.

Not having much luck with Torry's pages I'm afraid. However I've looked
at the FCL source, there is a mysqldb.pp in the db directory... Couldn't
that be used for sqlite (obviously with changes) ?

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 03:15:58PM +0200, Michael Van Canneyt wrote:
> 
> 
> On Tue, 15 Jul 2003, James Mills wrote:
> 
> > On Tue, Jul 15, 2003 at 04:36:24AM -0700, Alan Mead wrote:
> > >
> > > --- James Mills <[EMAIL PROTECTED]> wrote:
> > >
> > > > Just reconfirming with you and solidifying my knowledge.
> > > > The reason it returns "" is because: when working with
> > > > native pascal types, assigning null to a string results
> > > > in an empty string "" right ?
> > > >
> > > > cheers
> > > > James
> > >
> > > James,
> > >
> > > Pascal is a strongly typed language and there is no Pascal string
> > > precisely equivalent to a NULL.  Someone (either the SQLite authors
> > > or the one who wrote the Pascal wrapper) decided to automatically
> > > translate NULL into empty (zero-length) strings.  And it's impossible
> > > now to distinguish actual null values from fields containing actual
> > > zero-length strings.
> >
> > I think I'm slowly understanding this bit now. I don't claim to be an
> > SQL expert. But SQL (sqlite anyway) is capable of storing any data
> > types, strings, integers, boolean etc, including NULL values. I hope I'm
> > correct here...
> >
> > I don't believe the authors of the sqlite unit do translate NULL into
> > empty (zero-length) strings. I did check the source, check yourself if
> > I'm wrong.
> 
> They do. But implicitly, by converting a pchar to a string. A nil will
> be converted to an empty string.

Oh :)

It's funny how I haven't been able to actually reproduce this in some
test programs on Linux using FPC.

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-15 Thread James Mills
On Tue, Jul 15, 2003 at 04:36:24AM -0700, Alan Mead wrote:
> 
> --- James Mills <[EMAIL PROTECTED]> wrote:
> 
> > Just reconfirming with you and solidifying my knowledge. 
> > The reason it returns "" is because: when working with 
> > native pascal types, assigning null to a string results 
> > in an empty string "" right ?
> > 
> > cheers
> > James
> 
> James,
> 
> Pascal is a strongly typed language and there is no Pascal string
> precisely equivalent to a NULL.  Someone (either the SQLite authors
> or the one who wrote the Pascal wrapper) decided to automatically
> translate NULL into empty (zero-length) strings.  And it's impossible
> now to distinguish actual null values from fields containing actual
> zero-length strings.  

I think I'm slowly understanding this bit now. I don't claim to be an
SQL expert. But SQL (sqlite anyway) is capable of storing any data
types, strings, integers, boolean etc, including NULL values. I hope I'm
correct here...

I don't believe the authors of the sqlite unit do translate NULL into
empty (zero-length) strings. I did check the source, check yourself if
I'm wrong.

Why could I not simply check for '""' in my sql return functions and
simply return '' instead (a pascal empty string) ? Would this be
terribly wrong ? Or am I still going to have to follow Michael's
suggestion in finding a TDataset desendant ? (I don't understand what a
TDataset desendant really is and why I need to use one but anyway...)

> 
> You could solve this in several ways:
> 
> 1) re-write all the code to return and store a more complex record
> (as suggested in a previous post) that include a string and a
> boolean, this record completely and precisely captures the data SQL
> is returning;
> 
> 2) re-write the code that does the automatic translation to insert
> the string 'NULL' (in which case, you will never be able to
> distinguish NULL's from actual fields containing the value
> 'NULL'--but maybe this is no problem);
> 
> 3) you could simply avoid ever having empty strings in your database
> (in which case, empty strings returned are always NULL's)
There should be no empty string in my database anyway. If a field is
empty it's value is NULL.

> 
> 4) Live with not being able to distinguish, in many instances, an
> empty string is practically the same as a NULL (in other instances,
> however, it indicates that some records in a full join failed to find
> a match)

cheers
James

> 
> HTH,
> 
> -Alan
> 
> ______
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 03:06:44PM +0200, Michael Van Canneyt wrote:
> 
> 
> On Mon, 14 Jul 2003, James Mills wrote:
> 
> > On Mon, Jul 14, 2003 at 02:26:28PM +0200, Michael Van Canneyt wrote:
> > >
> > >
> > > On Mon, 14 Jul 2003, James Mills wrote:
> > >
> > > > On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> > > > >
> > > > >
> > > > > On Mon, 14 Jul 2003, James Mills wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > > > > > I'm not sure... I have been discussing this same problem on the SQLite
> > > > > > mailing list but without success there, so perhaps someone here might
> > > > > > know...
> > > > > >
> > > > > > I have attached a test database, which contains 1 database entry, null
> > > > > > strings are inserted using NULL... Check the database schema yourself.
> > > > > >
> > > > > > The problem therein lies in the fact that test3.pas returns "" for the
> > > > > > query: SELECT channelNotice FROM channels WHERE channel LIKE 
> > > > > > '#ProLogiTech';
> > > > > > It should return a null string as it does in test2.pas and in the sqlite
> > > > > > shell program.
> > > > >
> > > > > The problem is that an implicity conversion from Nil to empty string is
> > > > > done. You cannot solve this as long as stringlists are used to contain
> > > > > the data. (ok, you could set 'Null' as the string, but that is sloppy)
> > > >
> > > > "is done." in what ? The SQLite library or TStringList ?
> > >
> > > sqlite.
> >
> > But you said "You cannot solve this as long as stringlists are used to
> > contain the data." This made me think it was a behaviour of TStringList
> > ... If it truely is a behaviour of SQLite, I'll get them to change it.
> 
> The problem is that there is no way to distinguish between a 'null' and
> an empty string once it is converted to a string. The information is
> simply lost.

Just reconfirming with you and solidifying my knowledge. The reason it
returns "" is because: when working with native pascal types, assigning
null to a string results in an empty string "" right ?

cheers
James

> 
> >
> > >
> > > >
> > > > >
> > > > > You'd need to have (as a minimum) an array of TField records:
> > > > >   TField = Record
> > > > > IsNull : Boolean;
> > > > > Value : String;
> > > > >   end;
> > > > >
> > > > > But this will require major changes, so I suggest trying to find or
> > > > > implement a TDataset descendent for SQLIte, this will solve most of
> > > > > your problems at once.
> > > >
> > > > How major would the changes be ? Otherwise I'll try and search for a
> > > > TDataset descendent ? Couldn't I write a descendent myself ? (I've kinda
> > > > of done something similar in creating a TDatabase descendant..., but it
> > > > doesn't solve my problem)
> > >
> > > Implementing a TDataset descendent is not easy, it'll take you at least
> > > a week (conservative estimate).
> >
> > Why is this a hard thing to do ? Give me some ideas here, you might be
> > conservative, but I don't muck around :)
> 
> Because TDataset is not an easy subject. You need to implement a lot of
> calls in a correct and predefined way.
> 
> Michael.
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Strange Segfault...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 06:48:06AM -0700, Alan Mead wrote:
> I'm running into this string problem as well.  I'd like to use
> strings longer than 255 but I get strange errors like:
> 
> [EMAIL PROTECTED] seq-bayes]$ fpc mcmc3pl.pas
> Free Pascal Compiler version 1.0.6 [2002/05/23] for i386
> Copyright (c) 1993-2002 by Florian Klaempfl
> Target OS: Linux for i386
> Compiling mcmc3pl.pas
> Assembling mcmc3pl
> Linking mcmc3pl
> mcmc3pl.o: In function `_READ_CONFIG$INTEGER$INTEGER$STRING$STRING':
> mcmc3pl.o(.text+0x147): undefined reference to
> `FPC_READ_TEXT_LONGSTR'
> mcmc3pl.o(.text+0x17c): undefined reference to `FPC_VAL_SINT_LONGSTR'
> mcmc3pl.o(.text+0x243): undefined reference to
> `FPC_READ_TEXT_LONGSTR'
> mcmc3pl.o(.text+0x278): undefined reference to `FPC_VAL_SINT_LONGSTR'
> mcmc3pl.pas(215) Error: Error while linking
> Closing script ppas.sh
> 
> [EMAIL PROTECTED] seq-bayes]$ fpc test_string500
> Free Pascal Compiler version 1.0.6 [2002/05/23] for i386
> Copyright (c) 1993-2002 by Florian Klaempfl
> Target OS: Linux for i386
> Compiling test_string500.pas
> test_string500.pas(15,13) Fatal: Internal error 
> 
> These errors disappear when I edit the string definitions back to
> length 255 or less. Should I just avoid using longer strings or is
> there a compiler switch I have to include?  Or is there a tutorial on
> FPC strings (I never used Delphi much)?  Or is this behavior fixed in
> 1.0.10?

I believe there is a compiler switch.

cheers
James

> 
> -Alan 
> 
> --- Matt Emson <[EMAIL PROTECTED]> wrote:
> > > Yes and no. Why is it so bad to write a function in that way ? It
> > could
> > > of course be written two different ways, but I'd rather this way
> > where I
> > > modify the string passed to the function.
> > >
> > > Explain it to me :) (I'm the only one that works on this project
> > of
> > > ~30,000 LOC, so I don't see any problem)
> > 
> > Turbo Pascal and Delphi 1 had a type called 'String'. This was
> > limited to
> > 255 chars, size of 256 chars, and position 0 holds the strings
> > length.
> > Delphi 2+ has a type called shortstring that behaves in exactly the
> > same way
> > as the old style string.
> > 
> > Delphi 2+ altered the string type to be a pointer to a chunk of
> > memory, and
> > added a whole load of compiler magic to make strings automatically
> > grow and
> > shrink, added reference counting and 'copy of change' functionality
> > (the
> > last two to aid in not having to copy a string until someone alters
> > it.)
> > This is where your problem lies.
> > 
> > Because FPC mimics Delphi string functionality, basically you'll
> > end up with
> > similar results.
> > 
> > You'd be much better off Returning a value, and thereby avoiding
> > the
> > potential for big allocation/deallocations. That or use
> > shortstrings.
> > 
> > Matt
> > 
> > 
> > 
> > ___
> > fpc-pascal maillist  -  [EMAIL PROTECTED]
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 03:39:36PM +0200, Michael Van Canneyt wrote:
> 
> 
> On Mon, 14 Jul 2003, James Mills wrote:
> 
> > On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> > >
> > >
> > > On Mon, 14 Jul 2003, James Mills wrote:
> > >
> > > > Hi,
> > > >
> > > > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > > > I'm not sure... I have been discussing this same problem on the SQLite
> > > > mailing list but without success there, so perhaps someone here might
> > > > know...
> > > >
> > > > I have attached a test database, which contains 1 database entry, null
> > > > strings are inserted using NULL... Check the database schema yourself.
> > > >
> > > > The problem therein lies in the fact that test3.pas returns "" for the
> > > > query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
> > > > It should return a null string as it does in test2.pas and in the sqlite
> > > > shell program.
> > >
> > > The problem is that an implicity conversion from Nil to empty string is
> > > done. You cannot solve this as long as stringlists are used to contain
> > > the data. (ok, you could set 'Null' as the string, but that is sloppy)
> > >
> > > You'd need to have (as a minimum) an array of TField records:
> > >   TField = Record
> > > IsNull : Boolean;
> > > Value : String;
> > >   end;
> > >
> > > But this will require major changes, so I suggest trying to find or
> > > implement a TDataset descendent for SQLIte, this will solve most of
> > > your problems at once.
> >
> > Where might I find such a descendent that using SQLite ? I'm not quite
> > sure what I'm looking for here... An initial search on google provides
> > some delphi units that are probably not what I'm looking for.
> 
> On the contrary, on Torry's pages there are some units that do exactly
> what I described.

Ok thanks. I had searched for "TDataset descendant sqlite pascal" one
page came up from Torry's pages.

*hits Mozilla, it crashes too much :P*

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Mon, 14 Jul 2003, James Mills wrote:
> 
> > Hi,
> >
> > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > I'm not sure... I have been discussing this same problem on the SQLite
> > mailing list but without success there, so perhaps someone here might
> > know...
> >
> > I have attached a test database, which contains 1 database entry, null
> > strings are inserted using NULL... Check the database schema yourself.
> >
> > The problem therein lies in the fact that test3.pas returns "" for the
> > query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
> > It should return a null string as it does in test2.pas and in the sqlite
> > shell program.
> 
> The problem is that an implicity conversion from Nil to empty string is
> done. You cannot solve this as long as stringlists are used to contain
> the data. (ok, you could set 'Null' as the string, but that is sloppy)
> 
> You'd need to have (as a minimum) an array of TField records:
>   TField = Record
> IsNull : Boolean;
> Value : String;
>   end;
> 
> But this will require major changes, so I suggest trying to find or
> implement a TDataset descendent for SQLIte, this will solve most of
> your problems at once.

Where might I find such a descendent that using SQLite ? I'm not quite
sure what I'm looking for here... An initial search on google provides
some delphi units that are probably not what I'm looking for.

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 02:26:28PM +0200, Michael Van Canneyt wrote:
> 
> 
> On Mon, 14 Jul 2003, James Mills wrote:
> 
> > On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> > >
> > >
> > > On Mon, 14 Jul 2003, James Mills wrote:
> > >
> > > > Hi,
> > > >
> > > > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > > > I'm not sure... I have been discussing this same problem on the SQLite
> > > > mailing list but without success there, so perhaps someone here might
> > > > know...
> > > >
> > > > I have attached a test database, which contains 1 database entry, null
> > > > strings are inserted using NULL... Check the database schema yourself.
> > > >
> > > > The problem therein lies in the fact that test3.pas returns "" for the
> > > > query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
> > > > It should return a null string as it does in test2.pas and in the sqlite
> > > > shell program.
> > >
> > > The problem is that an implicity conversion from Nil to empty string is
> > > done. You cannot solve this as long as stringlists are used to contain
> > > the data. (ok, you could set 'Null' as the string, but that is sloppy)
> >
> > "is done." in what ? The SQLite library or TStringList ?
> 
> sqlite.

But you said "You cannot solve this as long as stringlists are used to
contain the data." This made me think it was a behaviour of TStringList
... If it truely is a behaviour of SQLite, I'll get them to change it.

> 
> >
> > >
> > > You'd need to have (as a minimum) an array of TField records:
> > >   TField = Record
> > > IsNull : Boolean;
> > > Value : String;
> > >   end;
> > >
> > > But this will require major changes, so I suggest trying to find or
> > > implement a TDataset descendent for SQLIte, this will solve most of
> > > your problems at once.
> >
> > How major would the changes be ? Otherwise I'll try and search for a
> > TDataset descendent ? Couldn't I write a descendent myself ? (I've kinda
> > of done something similar in creating a TDatabase descendant..., but it
> > doesn't solve my problem)
> 
> Implementing a TDataset descendent is not easy, it'll take you at least
> a week (conservative estimate).

Why is this a hard thing to do ? Give me some ideas here, you might be
conservative, but I don't muck around :)
I'll attach my dbclass.pas a tiny desendant I wrote to simplify using
queries (it's centered around making queries simpler)...

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG
unit dbClass;

interface

uses
	cMem, SQLite, SQLiteDB, Strings, Classes, Functions;

type
	TDatabase = class(TObject)
		constructor Create;
		destructor Destroy; override;
		protected
			SQL:		TSQLite;
			X:			Integer;
			Y:			Integer;
			S:			TStringList;

			function simpleQuery(query: String): String;
			function complexQuery(query: String): TStringList;
			function multiQuery(query: String): TStringList;
		public
	end;

implementation

constructor TDatabase.Create;
begin
end;

destructor TDatabase.Destroy;
begin
	inherited Destroy;

	if NOT (SQL = nil) then
		begin
			SQL.Free;
		end;
end;

function TDatabase.simpleQuery(query: String): String;
var
	tmp:	String;
begin
	tmp := query;
	replace('''''', 'NULL', tmp);
	writeLn('simpleQuery - ', tmp);
	if NOT (SQL = nil) then
		begin
			SQL.Query(tmp, nil);
			if (SQL.List_Field.count > 0) then
begin
	S := TStringList(SQL.List_Field.items[0]);
	simpleQuery := S.Strings[0];
end
			else
begin
	simpleQuery := '';
end;
		end;
end;

function TDatabase.complexQuery(query: String): TStringList;
var
	tmp:	String;
begin
	tmp := query;
	replace('''''', 'NULL', tmp);
	writeLn('complexQuery - ', tmp);
	if NOT (SQL = nil) then
		begin
			SQL.Query(tmp, nil);
			if (SQL.List_Field.count > 0) then
begin
	complexQuery := TStringList(SQL.List_Field.items[0]);
end
			else
begin
	complexQuery := TStringList.Create;
end;
		end;
end;

function TDatabase.multiQuery(query: String): TStringList;
var
	temp:	String;
	tmp:	String;
	I:		Integer;
	J:		Integer;
	strs:	TStringList;
begin
	temp := query;
	replac

Re: [fpc-pascal]SQLite and NULL Strings...

2003-07-14 Thread James Mills
On Mon, Jul 14, 2003 at 09:59:17AM +0200, Michael Van Canneyt wrote:
> 
> 
> On Mon, 14 Jul 2003, James Mills wrote:
> 
> > Hi,
> >
> > This is a very weird behaviour I've found of either SQLite, or the Unit.
> > I'm not sure... I have been discussing this same problem on the SQLite
> > mailing list but without success there, so perhaps someone here might
> > know...
> >
> > I have attached a test database, which contains 1 database entry, null
> > strings are inserted using NULL... Check the database schema yourself.
> >
> > The problem therein lies in the fact that test3.pas returns "" for the
> > query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
> > It should return a null string as it does in test2.pas and in the sqlite
> > shell program.
> 
> The problem is that an implicity conversion from Nil to empty string is
> done. You cannot solve this as long as stringlists are used to contain
> the data. (ok, you could set 'Null' as the string, but that is sloppy)

"is done." in what ? The SQLite library or TStringList ?

> 
> You'd need to have (as a minimum) an array of TField records:
>   TField = Record
> IsNull : Boolean;
> Value : String;
>   end;
> 
> But this will require major changes, so I suggest trying to find or
> implement a TDataset descendent for SQLIte, this will solve most of
> your problems at once.

How major would the changes be ? Otherwise I'll try and search for a
TDataset descendent ? Couldn't I write a descendent myself ? (I've kinda
of done something similar in creating a TDatabase descendant..., but it
doesn't solve my problem)

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


[fpc-pascal]SQLite and NULL Strings...

2003-07-13 Thread James Mills
Hi,

This is a very weird behaviour I've found of either SQLite, or the Unit.
I'm not sure... I have been discussing this same problem on the SQLite
mailing list but without success there, so perhaps someone here might
know...

I have attached a test database, which contains 1 database entry, null
strings are inserted using NULL... Check the database schema yourself.

The problem therein lies in the fact that test3.pas returns "" for the
query: SELECT channelNotice FROM channels WHERE channel LIKE '#ProLogiTech';
It should return a null string as it does in test2.pas and in the sqlite
shell program.

$ ./test2
Creating class
Fields Names ---
0 -> channel
1 -> owner
2 -> regTime
3 -> state
4 -> URL
5 -> email
6 -> channelNotice
7 -> joins
8 -> peak
9 -> games
10 -> modeLocked
11 -> mailLevel
12 -> restrict
13 -> entries
14 -> quota
15 -> channelIdle
16 -> noIdle
17 -> lastSuspension
18 -> hideAccess
19 -> keepTopic
20 -> onChannel
21 -> opRestrict
22 -> funMsg
23 -> mustId
24 -> tellAdd
25 -> tellDel
26 -> tellSet
27 -> msgNotice
28 -> topic
29 -> topicSetter
30 -> lastTopic
31 -> autoCmd
32 -> modes
Fields ---
0 -> #ProLogiTech  prologic  1057934559  REGISTERED1  1  0  0  1  50  0  
OFFNO  YES  YES  NO  NO  NO  NO  NO  NO  NO  

$ ./test3
Creating class
Fields Names ---
0 -> channelNotice
Fields ---
0 -> ""  

This should be: 0 ->  

Any ideas anyone  ?
The attached sqlite.pas and sqlitedb.pas were put together by Michael,
myself and Eric Jourde (possibly ported from tsqlite I hear)

cheers
James

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG
program test2;

uses cmem, sqlite,sqlitedb, strings,classes;

var
  MySQL: TSQLite;
  SQL: String;
  i,j : Integer;
  a : TStringList;
begin
  Writeln('Creating class');
  MySQL := TSQLite.Create('./channels.db');
  MySQL.BusyTimeout := 1000;
  
  SQL := 'SELECT * FROM channels WHERE channel LIKE ''#ProLogiTech'';';
  MySQL.Query(sql, nil);
  writeln('Fields Names ---');
  for i:=0 to MySQL.List_FieldName.count-1 do 
writeln(i,' -> ',MySQL.List_FieldName.Strings[i]);
  writeln('Fields ---');
  for i:=0 to MySQL.List_Field.count-1 do 
  begin
 	a:=TStringList(MySQL.List_Field.items[i]); 
 	write(i,' -> ');
for j:=0 to a.count-1 do  
  write(a.Strings[j],'  ');
writeln('');
  end;   

// Uncomment to remove table again.
//  SQL := 'DROP TABLE Test;';
//  MySQL.Query(sql, nil);
  MySQL.Free;
end.
program test3;

uses cmem, sqlite,sqlitedb, strings,classes;

var
  MySQL: TSQLite;
  SQL: String;
  i,j : Integer;
  a : TStringList;
begin
  Writeln('Creating class');
  MySQL := TSQLite.Create('./channels.db');
  MySQL.BusyTimeout := 1000;
  
  SQL := 'SELECT channelNotice FROM channels WHERE channel LIKE ''#ProLogiTech'';';
  MySQL.Query(sql, nil);
  writeln('Fields Names ---');
  for i:=0 to MySQL.List_FieldName.count-1 do 
writeln(i,' -> ',MySQL.List_FieldName.Strings[i]);
  writeln('Fields ---');
  for i:=0 to MySQL.List_Field.count-1 do 
  begin
 	a:=TStringList(MySQL.List_Field.items[i]); 
 	write(i,' -> ');
for j:=0 to a.count-1 do  
  write(a.Strings[j],'  ');
writeln('');
  end;   

// Uncomment to remove table again.
//  SQL := 'DROP TABLE Test;';
//  MySQL.Query(sql, nil);
  MySQL.Free;
end.


channels.db
Description: Binary data
{$mode objfpc}
unit sqlite;
interface

{
  Automatically converted by H2Pas 0.99.15 from sqlite.h
  The following command line parameters were used:
-S
-D
-p
-l
sqlite
sqlite.h
}

  const
External_library='sqlite'; {Setup as you need}

  { Pointers to basic pascal types, inserted by h2pas conversion program.}
  Type
PLongint  = ^Longint;
PSmallInt = ^SmallInt;
PByte = ^Byte;
PWord = ^Word;
PDWord= ^DWord;
PDouble   = ^Double;
PPPchar   = ^ppchar;

{$PACKRECORDS C}

const
  _SQLITE_VERSION = '2.8.3';
  SQLITE_ISO8859 = 1;

{$ifndef win32}
var
  sqlite_version  : pchar;cvar;external;
  sqlite_encoding : pchar;cvar;external;
{$endif}

const
  SQLITE_OK = 0;
  SQLITE_ERROR  = 1;
  SQLITE_INTERNAL   = 2;
  SQLITE_PERM   = 3;
  SQLITE_ABORT  = 4;
  SQLITE_BUSY   = 5;
  SQLITE_LOCKED = 6;
  SQLITE_NOMEM  = 7;
  SQLITE_READONLY   = 8;
  SQLITE_INTERRUPT  = 9;
  SQLITE_IOERR  = 10;
  SQLITE_CORRUPT= 11;
  SQLITE_NOTFOUND   = 12;
  SQLITE_FULL   = 13;
  SQLITE_CANTOPEN  

Re: [fpc-pascal]Strange Segfault...

2003-07-13 Thread James Mills
On Sun, Jul 13, 2003 at 09:56:20PM +0100, Matt and Lisa Emson wrote:
> > And yes Matt
> > Emson, I do understand why my original functions weren't working :)
> 
> including the part about not passing Strings as var params too? ;-P

Yes and no. Why is it so bad to write a function in that way ? It could
of course be written two different ways, but I'd rather this way where I
modify the string passed to the function.

Explain it to me :) (I'm the only one that works on this project of
~30,000 LOC, so I don't see any problem)

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Strange Segfault...

2003-07-13 Thread James Mills
On Fri, Jul 11, 2003 at 06:41:22AM -0700, Jeff Pohlmeyer wrote:
> (*
>   How about using "set of char" instead of "array of char" ?
>   That way, the compiler should be able to distinguish
>   between the overloads...
> *)
> program repl;
> 
> type 
>   tSetOfChar = set of char;
> 
> procedure replace(chars: tSetOfChar; const replace: String; var s: String);
> var
>   i: Integer;
> begin
>   for i:=length(s) downto 1 do if (s[i] in chars) then begin
> delete(s, i, 1);
> insert(replace, s, i);
>   end;
> end;
> 
> var 
>   w, s:string;
> begin
>   s:='a1ebf2c3d45';
>   readln(w);
>   replace(['0'..'9'], w, s);
>   writeln(s);
> end.

Thank you, this worked quite well and is what I needed. And yes Matt
Emson, I do understand why my original functions weren't working :)

cheers
James

> 
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
On Thu, Jul 10, 2003 at 05:25:21PM +0100, Matt Emson wrote:
> > > procedure replace(search: String; replace: String; var s: String);
> > > procedure replace(const chars: array of char; replace: String; var s:
> String);
> >
> > A string, or a array of char?
> 
> James, this (as Marco put it) was exactly what I had in mind. The compiler
> will have to make a decision, and as a string is implicitly and array of
> sorts, you most likely get this error.
> 
> If you had tried my advice,  you would have realised this was the case quite
> quickly. I was going for the school of hard knocks version of the answer,
> rather than handing it to you on a plate :P

Well ok thanks Matt, however I kind of already had this figured out, but
was posting here to find out if there's a way around it (other than
naming two separate functions)...

Perhaps there isn't...

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
On Thu, Jul 10, 2003 at 05:26:31PM +0200, Marco van de Voort wrote:
> > 15  replace(['0'..'9'], w, s);
> > (gdb) s
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > $08066073 in main () at test4.pas:15
> > 15  replace(['0'..'9'], w, s);
> > (gdb) 
> 
> Passing a set ( ['0'..'9'] ) to
>  
> > procedure replace(search: String; replace: String; var s: String);
> > procedure replace(const chars: array of char; replace: String; var s: String);
> 
> A string, or a array of char?
> 
> IMHO it is logical that it crashes?

I am passing ['0'..'9'] to a: const chars: array of char;

Can't you do this ? If not how else can I rewrite this function ?

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


Re: [fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
On Thu, Jul 10, 2003 at 03:58:02PM +0100, Matt Emson wrote:
> James, have you tried using non overloaded function calls?? ie. StrReplace
> and ArrReplace etc. It should take a few minutes to implement, and may yield
> the answer you're seeking.
> 
> I still prefer the way Delphi overloads. At least it explicitly implies it
> is doing so.

No I haven't and I'm not using Delphi mode, I'm using the native FPC
mode. This should make no difference however... Other overloaded
functions do not have this behaviour...

cheers
James

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

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


[fpc-pascal]Strange Segfault...

2003-07-10 Thread James Mills
(gdb) break 14
Breakpoint 1 at $806603c: file test4.pas, line 14.
(gdb) run
Starting program: /home/pircsrv/src/test4 
Enter a string: [EMAIL PROTECTED]
Replace all digits with ?
Breakpoint 1, main () at test4.pas:14
14  readLn(w);
(gdb) n
X
15  replace(['0'..'9'], w, s);
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
$08066073 in main () at test4.pas:15
15  replace(['0'..'9'], w, s);
(gdb) 


Can anyone help me find out what's going on here ?
It doesn't even go into the function and just segfaults! Makes me think
FPC can't handle the ['0'..'9'] passed to the function...

replace is defined as such:

procedure replace(search: String; replace: String; var s: String);
procedure replace(const chars: array of char; replace: String; var s: String);

procedure replace(search: String; replace: String; var s: String);
var
   startPos:   Integer;
   done:   Boolean;
begin
   done := FALSE;
   while NOT done do
  begin
 startPos := pos(search, s);
 if (startPos = 0) then
begin
   done := TRUE;
end
 else
begin
   delete(s, startPos, length(search));
   insert(replace, s, startPos);
end;
  end;
end;

procedure replace(const chars: array of char; replace: String; var s: String);
var
   index:  Integer;
   done:   Boolean;
begin
   done := FALSE;
   while NOT done do
  begin
 if NOT isin(s, chars, index) then
begin
   done := TRUE;
end
 else
begin
   delete(s, index, 1);
   insert(replace, s, index);
end;
  end;
end;

the isin functions are defined as such:

function isin(s: String; search: String): Boolean;
function isin(s: String; const chars: array of char): Boolean;
function isin(s: String; const chars: array of char; var index: Integer): Boolean;

function isin(s: String; search: String): Boolean;
begin
   if pos(search, s) = 0 then
  begin
 isin := FALSE;
  end
   else
  begin
 isin := TRUE;
  end
end;

function isin(s: String; const chars: array of char): Boolean;
var
   i: Integer;
begin
   isin := isin(s, chars, i);
end;
   
function isin(s: String; const chars: array of char; var index: Integer): Boolean;
var
   i: Integer;
begin
   isin := TRUE;
   for i := low(chars) to high(chars) do
  begin
 if NOT isin(s, '' + chars[i]) then
begin
   index := i;
   isin := FALSE;
   break; 
    end;
  end;
end;

Anything would be helpfull :)

cheers
James

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG

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


  1   2   >