[fpc-pascal] command line editing, history, etc.

2005-12-17 Thread Alan Mead
I have a command line utility that would really benefit from command line 
editing... is there a simple way to add this kind of readline-like behavior to 
a FreePascal program?  I would appreciate the functionality on Linux but I 
might also use the program on Windows.

-Alan



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


Re: [fpc-pascal] RE: command line editing, history, etc.

2005-12-19 Thread Alan Mead
Jeff,
 
 This works great on Linux... haven't tried it on Cygwin but I don't see why 
not...  Thanks!
 
 -Alan

- Original Message 
From: Jeff Pohlmeyer <[EMAIL PROTECTED]>
To: fpc-pascal@lists.freepascal.org
Cc: [EMAIL PROTECTED]
Sent: Saturday, December 17, 2005 15:17:19
Subject: [fpc-pascal] RE: command line editing, history, etc.

> I have a command line utility that would really benefit from
> command line editing... is there a simple way to add this
> kind of readline-like behavior to a FreePascal program?
> I would appreciate the functionality on Linux but I might
> also use the program on Windows.


This works for Linux ( and possibly Cygwin ) if you have the libs...



program histdemo;
{$LINKLIB ncurses}
{$LINKLIB readline}
{$LINKLIB history}
{$LINKLIB c}

uses strings;

function readline(prompt: pchar):pchar; cdecl; external 'readline'
name 'readline';
procedure using_history(); cdecl; external 'history' name 'using_history';
procedure add_history(s:pChar); cdecl; external 'history' name 'add_history';

var
  s:pChar;
begin
  s:=nil;
  WriteLn('type "quit" to exit.');
  using_history();
  repeat
s:=readline('?>');
add_history(s);
WriteLn(s);
  until ( StrComp(s, 'quit') = 0 );
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



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


[fpc-pascal] LINKLIB on Cygwin

2005-12-19 Thread Alan Mead
Jeff Pohlmeyer gave me a short program demonstrating the use of the readline 
and history libraries, the program begins:

 program histdemo;
{$LINKLIB ncurses}
{$LINKLIB readline}
{$LINKLIB history}
{$LINKLIB c}
It works great on Linux but I haven't been able to figure out how to get it to 
work under Cygwin.  I have the libraries in c:\cygwin\lib (e.g., 
libncurses.dll.a) and I have found different forms that allow the program to 
link (e.g., "{$LINKLIB ncurses.dll.a}" or "{$LINKLIB libncurses.dll.a}") but 
when I run the program I get a Windows dialog titled "Unable To Locate 
Component" and displaying "This application has failed to start because 
readline.dll was not found..."

I know very little about Windows programming or linking external libraries... 
any thoughts would be appreciated!

-Alan


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


Re: [fpc-pascal]GetMem crazy problem

2003-06-10 Thread Alan Mead
Eduardo,

I did not follow your example, but are you aware of the "growing
heap" behavior of FreePascal and the ReturnNilGrowHeapFails variable?

http://www.freepascal.org/docs-html/prog/progsu113.html#x163-1680008.4

Also, I think this ReturnNilGrowHeapFails behavior is broken in 1.0.6
and fixed in 1.0.7 (which, I think, is not available yet).

But I don't know why you get RTE 201?  (You should be getting 203 or
216 or something)

-Alan


--- Eduardo Morras <[EMAIL PROTECTED]> wrote:
> Hello:
>  I've got a weird problem with getmem. I have check
> everything (i 
> think) but i can't get it work. Heaptrc says it's all ok, but when
> i 
> de-comment the next three lines ( the freemem also ),  all fails
> 
>   GetMem(sDicc,sizeof(rtBusqBidimen));
>   GetMem(ppmv,sizeof(rtMotionVector));
>   GetMem(nDicc,sizeof(rtBusqBidimen));
> 
>   if (sDicc<>nil) AND (nDicc<>nil) AND (ppmv<>nil) then
>  writeln('MAS MEMORIA PARA VECTORMOTION') // Chequeo de
> memoria 
> INICIAL
> {More Memory for VECTORMOTION //NITIAL memory check}
>   else begin
> ..
> 
> The sizes are 14,8,14, MemAvail says near 48Mb and MaxAvail 47'5. I
> 
> tried  to put them in the program vars (they are in a function),
> change the 
> sizeof (which print on screen 14,8,14) to it's values re-type for a
> 
> misspelling error. Their declartions at var are
> 
> nDicc,sDicc   : prtBusqBidimen;  // p= point r= record t= type
> BusqDimen
> ppmv : prtMotionVector;  // id. MotionVector
> 
> When skip the if (sDicc<>nil)... a runtime error 201 appears
> 
> what's the next step??
> 
> Any clues??
> 
> TIA
> 
> Las personas se dividen en tres grupos, los que saben contar y los
> que no.
>   There are three groups of people, who can count, and who
> cannot.
> 
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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


Re: [fpc-pascal]GetMem crazy problem

2003-06-10 Thread Alan Mead
I just looked at this again.  If you are really getting RTE 201 then
it (probably) has nothing to do with the GetMem's.  It means you are
over-indexing your arrays or seomthing similar.  Good luck.

-Alan
--- Alan Mead <[EMAIL PROTECTED]> wrote:
> Eduardo,
> 
> I did not follow your example, but are you aware of the "growing
> heap" behavior of FreePascal and the ReturnNilGrowHeapFails
> variable?
> 
>
http://www.freepascal.org/docs-html/prog/progsu113.html#x163-1680008.4
> 
> Also, I think this ReturnNilGrowHeapFails behavior is broken in
> 1.0.6
> and fixed in 1.0.7 (which, I think, is not available yet).
> 
> But I don't know why you get RTE 201?  (You should be getting 203
> or
> 216 or something)
> 
> -Alan
> 
> 
> --- Eduardo Morras <[EMAIL PROTECTED]> wrote:
> > Hello:
> >  I've got a weird problem with getmem. I have check
> > everything (i 
> > think) but i can't get it work. Heaptrc says it's all ok, but
> when
> > i 
> > de-comment the next three lines ( the freemem also ),  all fails
> > 
> >   GetMem(sDicc,sizeof(rtBusqBidimen));
> >   GetMem(ppmv,sizeof(rtMotionVector));
> >   GetMem(nDicc,sizeof(rtBusqBidimen));
> > 
> >   if (sDicc<>nil) AND (nDicc<>nil) AND (ppmv<>nil) then
> >  writeln('MAS MEMORIA PARA VECTORMOTION') // Chequeo de
> > memoria 
> > INICIAL
> > {More Memory for VECTORMOTION //NITIAL memory check}
> >   else begin
> > ..
> > 
> > The sizes are 14,8,14, MemAvail says near 48Mb and MaxAvail 47'5.
> I
> > 
> > tried  to put them in the program vars (they are in a function),
> > change the 
> > sizeof (which print on screen 14,8,14) to it's values re-type for
> a
> > 
> > misspelling error. Their declartions at var are
> > 
> > nDicc,sDicc   : prtBusqBidimen;  // p= point r= record t=
> type
> > BusqDimen
> > ppmv : prtMotionVector;  // id. MotionVector
> > 
> > When skip the if (sDicc<>nil)... a runtime error 201 appears
> > 
> > what's the next step??
> > 
> > Any clues??
> > 
> > TIA
> > 
> > Las personas se dividen en tres grupos, los que saben contar y
> los
> > que no.
> >   There are three groups of people, who can count, and who
> > cannot.
> > 
> > 
> > 
> > ___
> > fpc-pascal maillist  -  [EMAIL PROTECTED]
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> 
> =
> A Congressman was once asked about his attitude toward whiskey. 
> "If you mean the demon drink that poisons the mind, pollutes the
> body, desecrates family life, and inflames sinners, then I'm
> against it. "
> 
> "But if you mean the elixir of Christmas cheer, the shield against
> winter chill, the taxable potion that puts needed funds into public
> coffers to comfort little crippled children, then I'm for it."
>  
> "This is my position, and I will not compromise."
> 
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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


Re: [fpc-pascal]GetMem crazy problem

2003-06-10 Thread Alan Mead

--- Eduardo Morras <[EMAIL PROTECTED]> wrote:
> At 12:46 10/06/2003 -0700, you wrote:
> >I just looked at this again.  If you are really getting RTE 201
> then
> >it (probably) has nothing to do with the GetMem's.  It means you
> are
> >over-indexing your arrays or seomthing similar.  Good luck.
> >
> >-Alan
> 
> 
> That's what surprise me, so rechecked and yes, the rte is 201. I
> get the 
> error when i don't check them for nil. If i chek the nil, the
> program never 
> enters in the code. I use them to navigate throught lists
> structures 
> defined as global. As said, if i define them as global too i
> get the 
> GetMem works!!!...   and the rte 201 apears again. Perhaps i use
> them 
> badly, but the main problem for me was the not allocation of memory
> for them.
> 
> 
> Also i use fpc 1.08

Is 1.0.8 available?  I just checked www.freepascal.org and it seems
like 1.06 is the current release.  You might try that version and see
if the problem goes away.

-Alan


=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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


[fpc-pascal]/usr/lib/fpc/1.0.6/ppc386 vs. /usr/bin/fpc vs. fpc.cfg?

2003-06-14 Thread Alan Mead
Are there known issues with 1.0.6 and it's finding the configuration
file?  Does it matter whether I compile using the 'fpc' or 'ppc386'
command (they differ on my system):

[EMAIL PROTECTED] ian]$ more ~amead/fpc.cfg
-gl
-Co
-Cr
[EMAIL PROTECTED] ian]$ ls -l `which ppc386`
lrwxrwxrwx1 root root   25 May 17 08:49
/usr/bin/ppc386 -> /usr/lib/fpc/1.0.6/ppc386*
[EMAIL PROTECTED] ian]$ ls -l `which fpc`
-rwxr-xr-x1 root root78020 May 23  2002 /usr/bin/fpc*
[EMAIL PROTECTED] ian]$ ls -l /usr/lib/fpc/1.0.6/ppc386
-rwxr-xr-x1 root root   897844 May 23  2002
/usr/lib/fpc/1.0.6/ppc386*
[EMAIL PROTECTED] ian]$ rpm -qf /usr/bin/fpc
fpc-1.0.6-1
[EMAIL PROTECTED] ian]$ rpm -qf /usr/lib/fpc/1.0.6/ppc386
fpc-1.0.6-1

I ask because my programs are not automatically being compiled with
the desired options '-Cr -Co -gl'.  I can enable range checking in
the source file with {$R+}, is there a similar solution for -gl?

-Alan

=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
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


Re: [fpc-pascal]free pascal cross compiler from windows to linux working.

2003-06-28 Thread Alan Mead


--- Harald Houppermans <[EMAIL PROTECTED]> wrote:

> I am just wondering if the free pascal compiler can set these
> permission
> automatically for the linux executables.

No, there is no executable bit to set in the Windows attribute set. 
How are you copying it?  When I read files off a floppy, they are
often all copied with their executable bit set (which is annoying).

> ( Is that the right term, linux executables ? :) )

Yes.

> So other weird red hat linux server behaviour... I have to use: 
> ./hello
> ( just hello does work on knoppix )
> 
> That's probably a red hat linux server setting... ./ means current
> folder...

Yes, Red Hat and other vendors arrange your environment in this way
on purpose.  This is felt to be "best practice" because it makes it
harder for you to accedentally execute a trojan...  If you wanted,
you could modify your path in .bash_profile in your home directory to
include the current directory (add it to the END of the list). 

> 
> Just wondering what that is all about.
> 
> I ll bet I'll also write a tutorial so others can do it.
> 
> Also with a little side note why I want it... many asked why not
> install
> linux.
> 
> My short answer would be: 1. no space. 2. I read linux can destroy
> NTFS
> partitions :)
> 
> Since I have windows xp ntfs and windows 98 fat32 paritions I don't
> want
> that now do I :)
> 
> Later.
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
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


Re: [fpc-pascal]RE: free pascal cross compiler from windows to linux

2003-06-30 Thread Alan Mead
--- Jeff Pohlmeyer <[EMAIL PROTECTED]> wrote:
> 
> > When I read files off a floppy, they are often all copied with 
> > their executable bit set (which is annoying).
> 
> You should be able to control this by adding the "noexec" or "exec"
> 
> option to the floppy entry in your /etc/fstab file:
> 
>   /dev/fd0  /floppy  auto   noauto,user,noexec 0   0
> 
> 
> Or from the command line (as root) :
> 
>   umount /floppy
>   mount -o noexec /floppy
>   ls /floppy 
>   umount /floppy
>   mount -o exec /floppy
>   ls /floppy

Cool, I'll give this a try.

-Alan



=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
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


Re: [fpc-pascal]New to the list/question

2003-07-09 Thread Alan Mead
Kevin,

Welcome!  What do you mean by a "text-based interface"?  

-Alan

--- Kevin Monceaux <[EMAIL PROTECTED]> wrote:
> Pascal enthusiasts,
> 
> I'm new to the list and just wanted to introduce myself.  I got my
> first
> tast of Pascal in college on a VAX 11/750 under the VMS operating
> system.
> Nowdays Linux is my preferred platform.  I was thrilled to discover
> Free
> Pascal.  It's like becoming reacquanted with an old friend.  I have
> one
> question.  Are there any modules available to easily create text
> based
> user interfaces?  I know now days everyone prefers GUI interfaces. 
> For
> quick data entry one can't beat a good old text based user
> interface.
> 
> 
> 
> Thanks,
> 
> Kevin
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
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


Re: [fpc-pascal]New to the list/question

2003-07-09 Thread Alan Mead
Well then let me rephrase the question:  What functionality are you
looking for?  

All your programs will, by default, be console applications that use
write/writeln and read/readln.  There is also a few flavors of the
CRT unit containing more advanced console-based primitives like
ReadKey() and Window().

-Alan

--- Kevin Monceaux <[EMAIL PROTECTED]> wrote:
> Alan,
> 
> Text based - something that would run on a Linux text console, old
> dumb
> terminal, DOS in the days before Windows, etc.
> 
> 
> Kevin
> 
> On Wed, 9 Jul 2003, Alan Mead wrote:
> 
> > Kevin,
> >
> > Welcome!  What do you mean by a "text-based interface"?
> >
> > -Alan
> >
> > --- Kevin Monceaux <[EMAIL PROTECTED]> wrote:
> > > Pascal enthusiasts,
> > >
> > > I'm new to the list and just wanted to introduce myself.  I got
> my
> > > first
> > > tast of Pascal in college on a VAX 11/750 under the VMS
> operating
> > > system.
> > > Nowdays Linux is my preferred platform.  I was thrilled to
> discover
> > > Free
> > > Pascal.  It's like becoming reacquanted with an old friend.  I
> have
> > > one
> > > question.  Are there any modules available to easily create
> text
> > > based
> > > user interfaces?  I know now days everyone prefers GUI
> interfaces.
> > > For
> > > quick data entry one can't beat a good old text based user
> > > interface.
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Kevin
> > >
> > > ___
> > > fpc-pascal maillist  -  [EMAIL PROTECTED]
> > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >
> > =
> > A Congressman was once asked about his attitude toward whiskey. 
> "If you mean the demon drink that poisons the mind, pollutes the
> body, desecrates family life, and inflames sinners, then I'm
> against it. "
> >
> > "But if you mean the elixir of Christmas cheer, the shield
> against winter chill, the taxable potion that puts needed funds
> into public coffers to comfort little crippled children, then I'm
> for it."
> >
> > "This is my position, and I will not compromise."
> >
> > __
> > 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
> >
> >
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

=
A Congressman was once asked about his attitude toward whiskey.  "If you mean the 
demon drink that poisons the mind, pollutes the body, desecrates family life, and 
inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the 
taxable potion that puts needed funds into public coffers to comfort little crippled 
children, then I'm for it."
 
"This is my position, and I will not compromise."

__
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


[fpc-pascal]FORTRAN-like read

2003-07-09 Thread Alan Mead
I want to provide a formatted read like FORTRAN's.  I have found a
public-domain implementation but it concatenats the input data as
bytes, making assumptions about the endian-ness and size of various
types.  The alternatives I've devised are (1) returning a sequence of
strings or (2) a linked list of records.  

Is there a way, possibly an OOP way, of representing a sequence of
values of arbitrary type?  

Thanks!

-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


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

2003-07-14 Thread Alan Mead
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?

-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


Internal error 8888 (was Re: [fpc-pascal]Strange Segfault...)

2003-07-14 Thread Alan Mead

--- James Mills <[EMAIL PROTECTED]> wrote:
> 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:
> > 
[...]

> I believe there is a compiler switch.


If there is, I cannot find it. {$H} does nothing and I re-read the
portion of the docs that deal with the sting types again and I don't
see what I'm doing wrong.  

If I declare "stmp: ansiString;" then the executable compiles and
links fine but the strings don't actually work.  For example, I
"readln(txt,stmp);" and stmp only receives the first 255 columns of
the file.

-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


Re: Internal error 8888 (was Re: [fpc-pascal]Strange Segfault...)

2003-07-14 Thread Alan Mead
--- [EMAIL PROTECTED] wrote:
> 
> {$H+}
> or
> {$H-}
> 
> definitely works.

Sorry, by does nothing I meant that it does nothing to solve my
problems with strings.  Of course, the fundamental problem is that I
don't fully understand anything but old-fashioned TP strings.

[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(21,13) Fatal: Internal error 

I'll upgrade to 1.0.10 soon ... so if that solves this problem,
great.  

-Alan

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com{$H+}
program test;

const LEN = 500;

type
  string500 = ansistring;
  {string500 = string[LEN];}

var
  s:string500;
  s2:ansistring;
  {s2:string[LEN];}

  procedure tester(s:string);
var s1:string500;
  s2:ansistring;
  {s2:string[LEN];}
begin
  s1 := 'Hello world';
  s2 := s;
  s1 := s;
end;

begin
  s := 'Hello world';
  s2 := 'Hello world';

  s:= s2;
  s2 := s;
  tester(s);

end.


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

2003-07-15 Thread Alan Mead

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

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)

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)

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


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

2003-07-15 Thread Alan Mead

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

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

-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


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

2003-07-15 Thread Alan Mead

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

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


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

2003-07-15 Thread Alan Mead

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

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


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

2003-07-15 Thread Alan Mead

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

Or you could, as you suggested earlier, just convert it to an empty
string.

-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


[fpc-pascal]What do you like about FPC?

2003-07-24 Thread Alan Mead
I don't have time right now to read all the messages that flew today
but I read enough to decide to send this note.  

IMHO, FPC is like a dream come true.  I love the fact that I can
compile the same code on Windows and Linux (and others).  I love the
ways the compiler is (mostly) backwards-compatible with turbo pascal
but also decidedly more powerful.  For what I do, the documentation
is very good.  I have never needed to resort to checking out the
source ... although I have asked some questions here.

I never used Delphi much.  I can imagine Delphi-o-philes not being
satisfied with FPC.  Delphi is so much more than a compiler.  I
wouldn't bet against FPC reaching that level of bloat... I mean
functionality... but it will take some time.

-Alan Mead

__
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


[fpc-pascal]ASCII plotting

2003-07-29 Thread Alan Mead
I would like to include some simple "ascii plots" in my textual
output files, like :

10.0|  **
| *  *
| *  *
|**
|**
*  *
*   *
**
* *
* *
*  *
0.00|---*-*-
 -3.5  3.50

I've coded something simple ... three times now... and I now realize
how complex this can get.  Lot's of isues with changing scales,
optimizing the ouptut for very granular rows and columns, syncing the
plot with the labels, choosing "good" labels, etc.  For example, I
found that I need to draw a "line" between the points otherwise the
vertical line segments get lost:

10.0|  **
| *  *
| 
|**
|  
|  *
|   *
|*
| *
|  
*  *
0.00|---*-*-
 -3.5  3.50

But now I find that if I choose too many X values then the line
segment drawing tends to make the make the drawing "fat", especially
at the tails:

10.0|  **
| *  *
| *  *
|**
|* *
|* *
|* *
|*  *
**  *
****
** ***
0.00|---***-
 -3.5  3.50

Because I'm plotting discrete functions, changing the number of X
values requires a complicated interpolation procedure...

So, does anyone, by chance, already have a unit for doing this?

-Alan Mead

__
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


Re: [fpc-pascal]HELP!

2003-08-05 Thread Alan Mead
You should consider subscribing to the list, at least briefly.

I think you are double-clicking on the free pascal executable which
opens a console window, prints some text, and quits.  The window
stays visible so you can read the text but the session is over.

To use Free Pascal this way, you would need to execute the IDE which
is like a combined editor, compiler, and debugger.  However, I don't
use Windows... but I don't think there the Windows IDE is ready yet
(list members: is this true??).  I think there is third-party Windows
IDE, maybe it's in the docs or someone will give you a pointer.

To use Free Pascal without the IDE, and really even with the IDE, you
will probably want to learn a bit about DOS.  You will need to open a
DOS window (A.K.A., command window), change directories, edit files,
etc.  (You can use Notepad or Wordpad or any other editor that edits
plain text). To compile the program, I would recommend:

fpc -gl -Co -Cr 

This will get you started... you need to learn a bit about DOS, I'm
afraid, to really feel comfortable running FPC this way.

Regarding the path, when you are in a DOS window, you can see the
path by typing 'path'.  I usually do this (let's assume your FPC
executables are installed in c:\fpc\bin\win32):

1.  put the current path into a batch file:

path > delme.bat

2. edit batch file to make it set the path and add the extra, you
want this:

set PATH=(old path); c:\fpc\bin\win32

where PATH=(old path) is what's the file when you start editing

3. execute the batch file by typing it's name

4.  To make this permanent, copy the set path line to your
c:\autoexec.bat ... this is a little tricky if your computer is
networked.  Networks often re-arrange your path.

Hope this helps,

-Alan

--- Catherine Berridge <[EMAIL PROTECTED]> wrote:

-
Dear Free Pascal
 
Help! 
I'm new to this programming business.  I think I've successfully
installed free pascal but after that I'm lost.  Where am I supposed
to be typing the commands?  I've tried typing into the MSDOS
applications things but they all claim to be FINISHED and won't let
me.  I also don't know how to set the path as commanded by the
installation programme.
 
Please help!
 
Cathy
 
P.S I think I'm supposed to mention that I'm not subscribed to the
mailing lists.



-
Protect your PC from e-mail viruses.  Get MSN 8 today.
___fpc-pascal maillist  -

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


__
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


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

2003-09-12 Thread Alan Mead
Is this something demonstrable in a small program?


--- James Mills <[EMAIL PROTECTED]> 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.
> 
> 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


__
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


Re: [fpc-pascal]several questions

2003-09-12 Thread Alan Mead

--- Thomas Schatzl <[EMAIL PROTECTED]> wrote:
> >When I run pascal programs (not just FP, but other compilers
> too), the
> > last text-colour I used stays even after the program is finished.
> The
> > original default colour only returns after I call something else.
> e.g.
> > DR-DOS editor.
> 
> FPC doesn't use the BIOS functions for drawing text characters in
> DOS - so
> the original text attributes should be preserved after exiting for
> new text.
> It leaves the current contents as they are by default though, this
> is
> normal.

Donald, I've never used FP on DOS.  There is a museum section of the
Borland.com site where you can (legally) download an old version of
Turbo Pascal for hobbiest purposes.  As I recall, Turbo Pascal
exhibited the behavior you describe and the solution was to save the
state of the text when the program starts and restore it (or restore
it to what you like as a default) right before clsoing.  I think
there was also a DOS command to reset to the default.  Sorry I don't
recall specifics, that was a *long* time ago.

Also, as I recall, 20 file handles wasn't a lot.  Each buffer only
costs ~2k, IIRC, so I would bump it up and see if your problem
disappears.  I definitely opened more than 2 files at once using
turbo pascal and DOS.  I think we had to set FILES=50 or =99 to run
WordPerfect 4.x and 5.x under DOS.

-Alan




__
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


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

2003-09-13 Thread Alan Mead
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)?

-Alan

--- James Mills <[EMAIL PROTECTED]> wrote:
> 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


__
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


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

2003-09-14 Thread Alan Mead
--- 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?

-Alan



__
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


[fpc-pascal]XP=extreme pain in the butt

2003-09-17 Thread Alan Mead
Is there a win32 binary install kit for Lazarus?  I see hints that
Lazarus runs on Win32 but the download folders for Win32 are empty. 
(Apologies if I'm not supposed to ask about Lazarus here...)

So I fetched the latest FPC win32 full install ZIP from the US mirror
but when I clicked on the install, I saw a screen that was basically
blank (blue background, some top bar and bottom bar text, but nothing
inside).  Then it disappeared.  Each subsequent double-click just
disappeared very quickly.  I don't see anything like install.exe
running in the taskmanager. Any ideas?  FPC installed fine on windows
98...

I have a cheap eMachines XP 2400+ (i.e., 2GHz) Athalon XP machine
(you know, the one that runs slow as a dog...)

Thanks!

-Alan

__
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


Re: [fpc-pascal]XP=extreme pain in the butt

2003-09-23 Thread Alan Mead

--- "A.J. Venter" <[EMAIL PROTECTED]> wrote:

[Alan explains that the install crashes on his new XP machine]

> Perhaps you should try to run the installer with XP's "windows 98
> compatibility mode" - should find that under the properties sheet
> for
> the app - there's a '95 mode as well.
> 
> I don't know if this will work/help at all, I don't use windows, a
> friend who does pointed it out - but he doesn't code so he
> obviously
> never tried it for FPC.

This didn't seem to have any effect but when I ran it from a command
window, I could observe an error message so I submitted a bug report:

http://www.freepascal.org/bugs/showrec.php3?ID=2692

Is it terribly difficult to install FPC manually on Win32?  Are there
registry settings?  Or is it just getting the targets and patterns
right?  I still have my old win98 machine that ran FPC reliably...
Could I just copy the relevant directories to my XP machine?

-Alan

__
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


Re: [fpc-pascal].ppu and .o files

2003-10-03 Thread Alan Mead
The .ppu are compiled units.  You probably want to keep them hanging
around, but it's not neccessary.  If you delete them, the compiler
simply needs to re-compile all the units each time you compile.  If
you leave them, I think it will only compile the changed units and
the main program. 

I think the .o files can be deleted.

-Alan

--- Andy Sy <[EMAIL PROTECTED]> wrote:
> Upon compiling the freepascal compiler from cvs, I noticed a lot of
> .o and .ppu files generated in addition to the final executable.
> What is the difference between .o and .ppu files and can I delete
> them
> both to eliminate the clutter?



__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


[fpc-pascal]Full-featured output library

2003-11-18 Thread Alan Mead
Using FPC, I have created a program to perform a specific type of
statistical analysis.  It's entirely console-based and it runs on
both Linux and Windows.  

I currently create text output but I'd like to have tables and
graphs.  Is there a library that would allow me to create output in a
variety of formats like PostScript, PDF, Word, RTF, HTML?  I would
need it to work on Windows and Linux.  This seems like a tall order
but I thought I would ask...  maybe OOo could be accessed or
something.  Any advice appreciated.

Thanks!

-Alan Mead

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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


Re: [fpc-pascal]Full-featured output library

2003-11-19 Thread Alan Mead

--- Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> All 100% Object Pascal. Still under development, but usable, and
> I'm
> open to suggestions for improvement.

Thanks for this reply!  I'd like to try this but my knowledge of
Pascal programming was frozen around TP 5.  (Before OOP and before
Borland Pascal). How would I get started with the FCL?  I printed the
FCL reference but it's not a tutorial.  Are there any examples using
the FCL (I don't see any in the examples directory)?

-Alan


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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


[fpc-pascal]Profiling FPC executables

2003-11-26 Thread Alan Mead
I'm writing a simulation that will take hours or days to run.  I've
never used formal profiling tools but this seems like a good
opportunity.  I'm working on Linux and I'm still using FPC 1.0.10. 
What tools are available to me?

Thanks!

-Alan

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


Re: [fpc-pascal]Profiling FPC executables

2003-11-26 Thread Alan Mead
Thanks Peter and Marco!  This is very helpful.

-Alan

> For the moment only gprof. Maybe in the future also
> valgrind/cachegrind
> 
> Compile your program with -pg
> Start your program (this will generate a gmon.out)
> Run gprof 
> 
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


RE: [fpc-pascal]opening files from a text list

2003-11-29 Thread Alan Mead
Donald,

What happens if the "Mighty Ducks" or the "White Sox"--or my
favorite, "Eat at Joe's" play?  The compiler reads strings just fine
but you as the programmer need to understand data types.  You also
need to understand your problem.  Parsing arbitrary and possibly
inconsistent psuedo-English sentences is a very, very hard job and no
compiler is going to get it right.

That said, I suggest you check out regular expressions.  I believe I
saw a regex support somewhere for FPC but I haven't used it with FPC.
   They are the technology for making many (but not all) simple
parsing problems easy.  In order to use regex's, you'll see that you
first have to have a good grasp of how you want data parsed.

-Alan


--- DONALD PEDDER <[EMAIL PROTECTED]> wrote:
> > here is just another approach.
> 
>I'll have a look at that as well. Why doesn't the compiler have
> the
> ability to read a word? All of this extra code needed because I
> have to
> read words one character at a time! It would be the single most
> useful
> addition. I don't understand why compilers have no problems reading
> multi-digit numbers in one hit, but can't do the same with words.
> 
> thanks,
>   dp.
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


Re: [fpc-pascal]Random generator

2003-12-06 Thread Alan Mead
My version of Linux includes a /dev/random.  Is there any way to use
this to get better random sequences.  When I cat this device, it
looks like it runs out of data pretty quickly, but I bet it would
make a series of fairly random seeds...

-Alan

--- jordi <[EMAIL PROTECTED]> wrote:
> El ds, 06 de 12 de 2003 a las 21:06, Jonas Maebe escribió:
> 
> > As long as you use pseudo-random number generators, you will not
> be 
> > able to generate sequences that are very hard to redo. They are
> per 
> > definition easy to reproduce, even if you mix 100 different
> sequences. 
> > If you want to encrypt something or authenticate, you have to
> look into 
> > encryption respectively authentication methods, and not at 
> > pseudo-random generators.
> > 
> > 
> > Jonas
> 
> Ok, thanks.
> 
> Jordi
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


Re: [fpc-pascal]Random generator

2003-12-07 Thread Alan Mead
--- Florian Klaempfl <[EMAIL PROTECTED]> wrote:
> /dev/random is very random, it's gets it's data from an "entropie
> pool" 
> which is filled using the random times when hardware interrupts are
> 
> triggered. Because this pool has a limited size and only a few
> hardware 
> interrupts per second happen, this random generator runs quite fast
> out 
> of data. There is also a "non"-blocking random device which uses a
> usual 
> random generator when the entropie pool runs out of data, but I
> don't 
> remember it's name.

This reply is vary long.

After I posted this, I looked into these devices.  They were written
by Theodore T'so of kerberos fame and, I have to imagine, intended to
produce crypotgraphically-secure randomness.  As you say, /dev/random
produces data that should be close to truely random but in fits and
not very much.  The other device is /dev/urandom.  Some people may
also have a /dev/hwrandom which may, or may not, work.  It sounds
like Intel included a hardware RNG on some chips.  There were several
sites that described generating random numbers from sound card white
noise.  I also looked into hardware RNG's.  It looked like these
would be a (small) project and cost at least 80-140 USD.  

Here is a comparison of the FPC 1.0.10 random number generator and
the system devices:

[EMAIL PROTECTED] irt]$ uname -a
Linux alan 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown
[EMAIL PROTECTED] ent]$ fpc -v
Free Pascal Compiler version 1.0.10 [2003/06/26] for i386
Copyright (c) 1993-2003 by Florian Klaempfl
Fatal: No source file name in command line
[EMAIL PROTECTED] ent]$ ./ent fpcrandom.txt
Entropy = 7.982320 bits per byte.

Optimum compression would reduce the size
of this 1 byte file by 0 percent.

Chi square distribution for 1 samples is 244.81, and randomly
would exceed this value 50.00 percent of the times.

Arithmetic mean value of data bytes is 128.9561 (127.5 = random).
Monte Carlo value for Pi is 3.142857143 (error 0.04 percent).
Serial correlation coefficient is 0.005214 (totally uncorrelated =
0.0).
[EMAIL PROTECTED] ent]$ ./ent urandom.txt
Entropy = 7.14 bits per byte.

Optimum compression would reduce the size
of this 2252800 byte file by 0 percent.

Chi square distribution for 2252800 samples is 269.51, and randomly
would exceed this value 50.00 percent of the times.

Arithmetic mean value of data bytes is 127.5270 (127.5 = random).
Monte Carlo value for Pi is 3.141578731 (error 0.00 percent).
Serial correlation coefficient is -0.61 (totally uncorrelated =
0.0).
[EMAIL PROTECTED] ent]$ ./ent random.txt
Entropy = 7.892939 bits per byte.

Optimum compression would reduce the size
of this 1477 byte file by 1 percent.

Chi square distribution for 1477 samples is 212.05, and randomly
would exceed this value 97.50 percent of the times.

Arithmetic mean value of data bytes is 127.6141 (127.5 = random).
Monte Carlo value for Pi is 3.186991870 (error 1.45 percent).
Serial correlation coefficient is 0.000579 (totally uncorrelated =
0.0).

I would discount the chi-square because it varys a lot when you
repeat this experiment.  Also, I think of it having a one-tailed
distribution whereas the ent author interprets it as two-tailed. 
Also, note that the samples vary enormously in their size.  I got the
/dev/random and /dev/urandom samples by cat'ing the devices and
redirecting into a file (and then breaking).  So the /dev/urandom
sample is quite large and the /dev/random sample is pretty small. 
For the FPC generator, I wrote a very simple program that generated
10,000 random bytes, cast these as chars, and wrote them to disk.

The compression forecast and Monte Carlo estimation of Pi strike me
as the best indicators of how the RNG's operate relative to my needs.
 Way back, I used to plot this Pi test with the BGI unit and visually
inspect it for patterns.  By whichever method, clearly /dev/random
wouldn't work well as a random number generator although it might
provide good random seed values.  Is the FPC RandSeed  16 of 32 bits?
 Either way, you could probably re-seed from /dev/random every 30
seconds. To use the device in a Pascal program, just open
'/dev/random' or '/dev/urandom' as a text file and 'read(ran,ch)',
given 'ch:char;'.

-Alan

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


[fpc-pascal]CRT prevents break?

2004-01-01 Thread Alan Mead
I'm using "Free Pascal Compiler version 1.0.10 [2003/06/26] for i386"
on Linux 2.4.7-10 and when I use the CRT unit, I cannot break a
program with Control-C.  Even Control-Z doesn't stop the program's
execution.  I have to kill it.  I've attached an example program
(compile with "-dSCREWED_UP" to see the behavior I'm talking about). 


Is this a known issue?  Is there any work-around?  Sorry if this is
in the manual, I don't see anything about this in the CRT
documentation.

-Alan

__
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

nobreak.pas
Description: nobreak.pas


Re: [fpc-pascal]CRT prevents break?

2004-01-02 Thread Alan Mead

--- Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
> 
> This is a 'known issue'. It's normal behaviour. AFAIK, CTRL-C and
> CTRL-Z
> are normally handled by the shell. The CRT unit takes over the
> terminal,
> preventing the shell from catching these keys. There is no
> work-around
> except catching these keys yourself.

Thanks for the information. Can you give me a pointer to "catching
these keys" myself?  Also, does this mean that I won't have this
trouble on Windows?  I want to run it on a Windows XP machine as
well.

-Alan


__
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

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


Re: [fpc-pascal]CRT prevents break?

2004-01-03 Thread Alan Mead

--- [EMAIL PROTECTED] wrote:
> > Thanks for the information. Can you give me a pointer to
> "catching
> > these keys" myself? 
> 
> Just check the result of the next key with readkey. 
> It should return #3 for ctrl-c, and #26 for ctrl-Z.

Ah.  Now I see.  

It's been a while ... is ReadKey blocking?  If so, is there a
non-blocking function?  I recall I used to access the keyring in the
BIOS directly and I believe that is not proper (or possible).

I would have to insert this check inside a loop doing the real work. 
Well, I guess I could make a non-blocking ReadKey using KeyPressed.

Thanks again for your help.

-Alan

__
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

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


Re: [fpc-pascal]Free Pascal - general commet / suggestions

2004-01-14 Thread Alan Mead

--- Paschal Mushubi <[EMAIL PROTECTED]> wrote:
> because I can find free easy to use
> libraries to accomplish a lot of what I need to do which is usually
> developing Oracle
> database apps.
> Unfortunately I can't find the libraries (units) I am looking for.
> Has 
> someone tried to mimic the STL for example?
> If I knew FP well I could write a unit that does this 
> http://otl.sourceforge.net/otl3.htm#toc for example.
> or develop a generic database access layer like Perl DBI. 

I agree.  FPC is indeed a great language and I enjoy using it when I
need complex data types or fast execution (e.g., statistical
estimation).  But it's not the only tool in existance.  Perl has a
clear advantage in terms of available software, including the DBI.  I
doubt that FPC will ever catch up.  But no matter, I just use Perl
when it's a better choice.

I would hazard a guess that the installed FPC base using Oracle is
miniscule.  If you are earnest in wanting to write such a library,
this list will be happy to help you with the FPC issues you might
encounter.  We've had previous discussions about SQL topics.  In
abstract, I'd be interested in this but I wouldn't have any way to
test such code since the requirements to run even a demo version of
Oracle are slightly beyond me.

>Shouldn't effort be put in developing Internet aware 
> libraries targeting the web 
> instead of the traditional desktop? Any Internet site developed in
> FPC. 
> That wouldn't be a bad advertisement.
> I have browsed the site http://www.freepascal.org but I get the 

Sometimes advertisement is subtle.  I believe the FPC website IS
powered by FPC; FPC is certainly available for CGI and other web
applications and if you have a specific need that doesn't seem to be
met this list may well be able to point you towards a solution.

That said, I don't think the FPC community feels that chasing current
hype like .NET is a high priority.  Established and important
technologies appear because someone (like you or I) needs to use them
and decides to use them with FPC.

-Alan

__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

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


[fpc-pascal]Installing 1.9.2 rpm alongside 1.0.10

2004-01-23 Thread Alan Mead
Sorry, this is really an RPM question.  I'd like to try out the new
beta but without losing the official version (which was installed
using RPM).  Is it possible to install the 1.9.2 RPM alongside the
1.0.10 package?  (And if so, how?)  I'm running Red Hat 7.2 if that
matters...  Thanks!

-Alan

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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


[fpc-pascal]ARM packages of >= 1.9.3?

2004-03-30 Thread Alan Mead
I just got a Zaurus and I'd love to use FPC on it.  Or, failing that,
I'd like to try cross-compiling on Linux for ARM.  Are there any
Zarus users out there who could lend me a hand getting started?

-Alan

__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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


[fpc-pascal]Conditional compilation ELSE-IF?

2004-04-08 Thread Alan Mead
I have the following code in a function:

  {$IFDEF LINUX}
  Slash := '/';
  {$ENDIF}
  {$IFDEF WIN32}
  Slash := '\';
  {$ENDIF}

Obviously, FPC supports many other platforms.  Is there a better way
to handle this?  Also, will this work if I ever cross-compile? Is
there a way to detect this at run-time rather than compile time?

-Alan

__
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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


Re: [fpc-pascal]Conditional compilation ELSE-IF?

2004-04-08 Thread Alan Mead
--- Peter Vreman <[EMAIL PROTECTED]> wrote:
> {$if defined(linux)}
>   Slash:='/'
> {$elseif defined(win32)}
>   Slash:='\'
> {$elseif defined(macos)}
>   Slash:=':'
> {$else}
>   {$error Unsupported target}
> {$endif}
> 
> Better is to use PathSeparator from the System unit

Thanks to everyone who responded.

I just re-checked the docs (which are marked as current for 1.9; I'm
using the 1.0.10 build) and they don't list an $ELSEIF which is
consistent with the warning I get when I compile your code: 

verify.pas(50,2) Warning: Illegal compiler directive $ELSEIF

But your pointer to the system unit was very helpful; I'll use
system.DirectorySeparator, as you suggested.

Thanks again.

-Alan


__
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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


[fpc-pascal]Web strike

2004-04-09 Thread Alan Mead
Sorry if this is off-topic; I just saw the Free Pascal homepage. 
Yikes!  I think you are wise to be very concerned about software
patents.

Is there anything that US citizens can do to help?

-Alan

__
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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


Re: [fpc-pascal]Technojock...

2004-04-16 Thread Alan Mead
A lot of my old Pascal code has TTT dependencies. 

Maybe someone on the list knows the guy behind TTT but I tried to
track him down once and I didn't have a lot of luck.  I seem to
recall that the company moved once and then I figured it went out of
business (sorry I don't have the specifics).

Does it violate the copyright holder's rights to distribute patches?

-Alan


--- Gene Buckle <[EMAIL PROTECTED]> wrote:
> > On 16 apr 2004, at 07:50, Florian Klaempfl wrote:
> >
> > >> Before I spend any time on the port - has anyone ported the
> Turbo
> > >> Technojock Toolkit v5.10 to FPC?  I saw some mention of it on
> a four
> > >> year
> > >> old UseNet posting, but nothing after that.
> > >
> > > IIRC, Jonas Maebe (jonas at freepascal dot org) made fpc
> patches.
> > > Maybe you can contact him.
> >
> > I never got permission to distribute them by the owners of the
> rights
> > to that package.
> 
> Who is the owner?  Technojock.com is some witless sports website
> now...
> 
> g.
> 
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

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


[fpc-pascal]Easy graphics

2004-04-22 Thread Alan Mead
What is the easiest way to create PNG or JPG images from within a FPC
program?  Ideally, in a cross-platform way although I mostly use
Linux.  Thanks!

-Alan





__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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


[fpc-pascal]Unit png example?

2004-04-22 Thread Alan Mead
I just asked about a way to create images.  Then I saw the png unit
and I got it to link.

But now I'm lost trying to translate the libpng C examples to Pascal.
 Does anyone have an example or two of a program that uses unit png?

-Alan




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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


Re: [fpc-pascal]Easy graphics

2004-04-22 Thread Alan Mead
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> Very easy.
> 
> Roughly like this:
> 
> uses fpimage,fpcanvas,fpwritepng, fpwritejpg;
>
> [...]
> 
> See the fcl/image directory for all needed units.
> Supported are bmp,png,jpg,xpm and PPM/PBM.
> 
> There is no documentation yet, but I can provide some examples and
> explanations.
> This is fully cross-platform.

Michael,

This looks great but I'm currently using 1.0.10 and I don't see these
units.  Do I need to upgrade to a newer version?

-Alan





__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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


Re: [fpc-pascal]Easy graphics

2004-04-22 Thread Alan Mead
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> Yes. You need at least 1.9.2.
> The best would even be to download the latest CVS, as it supports
> more formats.
> Or you can try to download the FCL sources and recompile them with
> FPC 1.0.10.

I appreciate your help with this.  I installed 1.9.2 on my other
machine and I see most of the units (the writejpg is not found)...
you indicated that your code was only a rough sketch but I cannot get
it to compile:

[EMAIL PROTECTED] amead]$ cat j.pas
program j;
uses fpimage,fpcanvas,fpwritepng;
Var
  Image : TMemoryImage;
  Canvas : TFPimageCanvas;
begin
  Image := TMemoryImage.Create(640,480);
  Image.PaletteBased:=False;
  Canvas:=TFPImageCanvas.Create(Image);
  Canvas.Pen.Color:=colRed;
  Canvas.Circle(100,100,50);
  Canvas.Rectangle(50,50,150,150);
  Canvas.Free;
  Image.SaveToFile('myfile.png');
  Image.Free;
end.
[EMAIL PROTECTED] amead]$ fpc j.pas
Free Pascal Compiler version 1.9.2 [2004/01/07] for i386
Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling j.pas
j.pas(7,11) Error: Identifier not found "TMemoryImage"
j.pas(7,23) Error: Error in type definition
j.pas(8,12) Error: Identifier not found "TFPimageCanvas"
j.pas(8,26) Error: Error in type definition
j.pas(11,12) Error: Identifier not found "TMemoryImage"
j.pas(11,31) Fatal: Syntax error, ";" expected but "(" found

-Alan




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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


Re: [fpc-pascal]Fw: RE: Toolkit

2004-05-25 Thread Alan Mead
Frank,

This is cool.  So, IIRC the original TTT sources have a whole lot of
ASM code (I don't recall if it was ASM blocks on, I think my use
pre-dated ASM blocks).  Computers are so fast today that I wonder if
it is needed; would we want to port the asm or just replace it with
Pascal?  (Hint, hint:  I only know Pascal :)

-Alan

--- Frank W McCormick <[EMAIL PROTECTED]> wrote:
> 
> 
> Last month a few people were inquiring about porting the Bob
> Ainsbury toolkit to FPC - I tracked him down and
> here is his go-ahead. Have fun!
> 
> 
> 
> 
> 
> Begin forwarded message:
> 
> Date: Tue, 25 May 2004 08:04:06 -0700
> From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> To: "Frank W McCormick" <[EMAIL PROTECTED]>
> Subject: RE: Toolkit
> 
> 
> Frank,
> 
> Sorry for the delay. I was out of the country.
> 
> Yes, please feel free to use it, but you will need to make sure
> that we
> do
> not accept responsibility for these "derivative works", i.e. any
> defects
> that arise (even if they were in the original code) are your
> responsibility.
> Just don't want to inherit any pursuit from your customers.
> 
> Good Luck... and send me a copy!
> 
> Best Regards,
> 
> Bob "TJ" Ainsbury
> 
> -Original Message-
> From: Frank W McCormick [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 23, 2004 10:57 AM
> To: [EMAIL PROTECTED]
> Subject: Tooklit
> 
> 
> 
> 
> 
> Hi Bob.
> 
> This email is to seek permission from you to port your
> TechnoJock
> toolkit for Turbo Pascal to the latest FPC compiler.
> We realize that not too many
> people are still using Turbo-Pascal, so it would seem logical your
> work
> could go on in another form.
> If you like I could release the code under
> a modified GPL.
> 
> Hoping to hear from you.
> 
> 
> 
> --
> --
> Frank McCormick
> Montreal
> 
> --
> 
> 
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





__
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

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


Re: [fpc-pascal]RTF

2004-06-28 Thread Alan Mead
--- David G Jenkins <[EMAIL PROTECTED]> wrote:
> rtfpars
>  Contains a RTF (Rich Text Format) parsing class. All that
> needs to 
> be done is set some event handlers and you can display RTF wherever
> you 
> want.
> 
> I would like to use this to generate RTF files but don't have any 
> documentation about the functionality of this unit.

I can't help with rtfpars but I have had luck in the past using
templates.  RTF is pretty complicated and so constructing brand-new
documents from scratch might be complex.  But if you just need to
create a single kind of document, perhaps with some data changed,
then you can often solve the problem much more simply by:  (1) create
an RTF document in your favorite software; (2) Insert tags like
##ADDRESS1## where you want to substitute text; (3) read in the
template and replace the tags with the text of your choice.

If you have more slightly more complex needs... such as wanting to
insert the text of a letter, then the RTF that marks up standard text
is pretty simple, so:  (1) create the RTF file; (2) break it into a
"header" part and a "tail" part; (3) examine the simple mark-up for
the body and write your conversion routine.

This approach has some advantages: it's quick and relatively simple
and it practically garuantees that the generated RTF can be read
properly by your favorite software.  But it can also be really
cumbersome to change the template and it doesn't work if you need the
fancy RTF features.

There used to be a thick-ish RTF spec on the microsoft.com website
that you could examine if you wanted a better understanding of RTF.

-Alan

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


[fpc-pascal]Arjan Dronkers?

2004-07-16 Thread Alan Mead
Is Arjan Dronkers still on the list or does anyone know this author
of CFGR, a unit that assists Free Pascal users to read and write
configuration files?  I have made some modifications and bug fixes to
the code, dated 1999, and I wanted to get in touch with the author.

-Alan 

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


Re: [fpc-pascal]Math/Algebra Unit for FreePascal

2004-07-20 Thread Alan Mead
--- [EMAIL PROTECTED] wrote:
> I have the 'Numerical Recipes in Pascal' CD-ROM, but I
> suspect
> there might be copyright issues involved when distributing these
> algorithms
> :/

A version of the NR code is freely available on the net as a zip file
complete with the code and the examples.  The code matches the book
copyrighted 1986/1989, I don't know if there is a later edition.. I
think the readme in the zip file calls this an older version released
as shareware

The code is not particulary free but it seems a bit hazy.  The
colection is not free.  But, for example, I'm working on a problem
using sigular value decomposition right now and the SVDCMP.PAS
routine in NR is apparently a translation of free-er EISPACK
routines.

I would be cautious of GPL/LGPL units that that use NR code.  It's
not clear that that's legal... 

-Alan

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


[fpc-pascal]Two simple dynamic arrays questions

2004-07-28 Thread Alan Mead
Hi, I am new to dynamic/open arrays.  I've installed 1.9.4 and played
with the example code, read the docs, and converted a sample program
that I'd written using static arrays to dynamic.  I have two residual
questions:

(1) Previously, I had fillchar'd the static arrays with zeros because
they are sparse-ish.  Looks like dynamic arrays are automagically
filled with zeros.  Is this true/permanent?  Or a lucky coincidence
that I shouldn't count upon?  If the later, is there a fast one-liner
like fillchar that I can use to initalize array to zeros?

(2) There is no way, I supposed, to switch the array indexes to start
at 1 is there?  I ask not from intrasigence but because I am using
matricies and it rains on my elegance parade to have to perform the
trivial translation each time I want to access an element using
absolute row/column addresses.  I also have a lot of older code and
I'll have to hunt through it and make this change everywhere...

Thanks!

-Alan

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


[fpc-pascal]Extension of macros exceeds a depth of 16

2004-07-28 Thread Alan Mead
As a I mentined earlier today in a different thread, I have upgraded
to 1.9.4 and I appreciate the greater checking.

Most of the new warnings I get are clear but one of my units now
reports "Extension of macros exceeds a depth of 16".  What does this
warning mean and what is the rammification of ignoring it?

The line number where it reports the warning is an {$if def ...} and
I would assume the warning had something to do with nesting compiler
conditionals... but that's not the case (unless the parser is really
getting lost... but since the code operates, I cannot imagne that
this is happening..).  This conditional should be at the "top
level"--it is not nested under anything.

-Alan

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


RE: [fpc-pascal]Two simple dynamic arrays questions

2004-07-28 Thread Alan Mead
Yes, this is a good idea.  I think it thwarts length() and low() but
since I'm using two dimensional arrays, these aren't helpful...

I'm not a fluent OOP programmer, but I'm already using a record to
record the real rows and columns, matrix name, etc. so I think I'm
going to wrap these open arrays in an object so that I can supply
replacements for these and other methods and it would be easy to hide
this wrinkle inside the object.

-Alan

--- "Cox, Stuart TRAN:EX" <[EMAIL PROTECTED]> wrote:
> Would not allocating the dynamic arrays a single element greater in
> size not
> permit you to address their elements the way you'd like. 
> I.e.: for a five element array, allocate size 6 and get [0..5] and
> then use
> only [1..5]?  Just pretend that the [0] position doesn't exist.
> Of Course, you'd have to be careful with low(x) as the index
> starting spot.
> If this is too easy what am I missing?
> 
> Stu
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jonas
> Maebe
> Sent: Wednesday, July 28, 2004 12:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [fpc-pascal]Two simple dynamic arrays questions
> 
> 
> 
> On 28 jul 2004, at 19:48, Alan Mead wrote:
> 
> > (1) Previously, I had fillchar'd the static arrays with zeros
> because 
> > they are sparse-ish.  Looks like dynamic arrays are automagically
> 
> > filled with zeros.  Is this true/permanent?
> 
> Yes.
> 
> > (2) There is no way, I supposed, to switch the array indexes to
> start 
> > at 1 is there?
> 
> No, there is unfortunately no way to do this.
> 
> 
> Jonas
> 
> 
> ___
> 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
> 


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


Re: [fpc-pascal]Extension of macros exceeds a depth of 16

2004-08-04 Thread Alan Mead
Ah.  Or "Recursion of macros exceeds..."  I'll check my code.

-Alan

--- Olle Raab <[EMAIL PROTECTED]> wrote:

> 04-07-28 21.42, skrev Alan Mead följande:
> 
> > As a I mentined earlier today in a different thread, I have
> upgraded
> > to 1.9.4 and I appreciate the greater checking.
> > 
> > Most of the new warnings I get are clear but one of my units now
> > reports "Extension of macros exceeds a depth of 16".  What does
> this
>^^
>   Actually I think the warning message is wrong..
> 
> It should imo be "Expanding". I'll fix this.
>  
> > warning mean and what is the rammification of ignoring it?
> > 
> > The line number where it reports the warning is an {$if def ...}
> and
> > I would assume the warning had something to do with nesting
> compiler
> > conditionals... but that's not the case (unless the parser is
> really
> > getting lost... but since the code operates, I cannot imagne that
> > this is happening..).  This conditional should be at the "top
> > level"--it is not nested under anything.
> 
> It the recursive macro substitution which exceeds a depth of 16.
> 
> This is probably due to a circular definition of a macro, e g
> 
> {$DEFINE X = X}
> 
> So that X is replaced by X, which is replaced by X etc. This is
> probably not
> what you want.
> 
> After 16 replacements the recursion is stoped, thats what it is
> warned
> about.
> 
> Olle
> 
> 
> ___
> 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


[fpc-pascal]Delphi/FPC cross-compile

2004-08-04 Thread Alan Mead
My Delphi experience is limited to going through "Delphi for Dummies"
a few years back, I was once a proficient Turbo Pascal 5 programmer. 
I've been using FPC.. one of the things I really like about it is
being able to compile the same code on Windows and Linux.

I've been given a copy of Delphi (8, altough I may exchange it for 7)
and been asked to create a class that implements some non-visual
functionality (it will perform searches on textual data, like
Google.com).

I'm dreading giving up Linux compatibility.  Is it possible that I
could create the required class in such a way that it can be compiled
by both Delphi 7/8 and also by FPC?  If it's possible, is it
*reasonable* that I do this as a Delphi novice? Got any tips on
things to avoid?  I'm not even sure how I will do it without a
command line

Any recommendations on a good book for my context?  Using FPC and the
FPC docs, I tried making a class over the weekend and I did something
majorly wrong... I don't grok the difference between an object field
and a class property.

Thanks!

-Alan

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


Re: [fpc-pascal]exec and wait

2004-08-26 Thread Alan Mead

--- Marco van de Voort <[EMAIL PROTECTED]> wrote:

> [ Charset 0 unsupported, skipping... ]
> 
> (hmm)
> 
> Anyway, don't use unit DOS, it is legacy, but
> sysutils.executeprocess
> 

My win32 docs, installed as part of 1.9.4 and stamped '1.9' don't
seem to show this function.  What are the calling conventions?

Does anyone know how much data I can receive on the win32 command
line?  I recall it was pretty limited under DOS.

-Alan

-Alan

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


[fpc-pascal]CORBA

2004-08-27 Thread Alan Mead
I am creating a win32 program that needs to be called by a Cold
Fusion page to generate results for a particularly complex search. 
The CF guys tell me that they can execute my program (passing data to
it on the command line) or execute a function via CORBA.  The command
line looks infeasible so I promised to investigate CORBA.  

I see that "Corba support?" is listed under "Planned for later
versions" ... does that mean that I cannot use CORBA with Free
Pascal?  

When I google 'pascal corba bindings' I get hits but when I visit the
webpages I don't see links for pascal bindings.  Does anyone know of
links to FPC bindings (or information how I could create bindings..
if that's not a monumental task).

Any other thoughts about better ways to do this also appreciated.. I
know nothing of CF.  I have access to Delphi 7/8 but I would much
prefer to use FPC is possible...

-Alan

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


[fpc-pascal]Where is the error?

2004-08-31 Thread Alan Mead
I am trying to compile a Delphi matrix package using fpc 1.9.4 and I
don't know if I misunderstand FPC's overloading or if there is an FPC
problem. The code is located here:

http://www.fssc.demon.co.uk/Delphi/delphi.htm#TMatrix

Lines 84-85 define a transpose method:

84 function  transpose : TMatrix; {overload;}
85 function  transpose (m : TMatrix) : TMatrix; {overload;}

(I commented out the overload keyword.. doesn't seem to matter.).  I
don't see any forward declaration of 'transpose':

[EMAIL PROTECTED] misc code]$ grep -i transpose mat.pas
   function  transpose : TMatrix; overload;
   function  transpose (m : TMatrix) : TMatrix;
overload;
{ Transpose matrix 'Self', Self is thus destroyed and replaced   
 }
{ Usage:  A.transpose
 }
function TMatrix.Transpose : TMatrix;
{ move data from transpose to Self }
{ Transpose the matrix 'm' into Self 
 }
{ Usage:  T.transpose (A);   Tranposes A and puts result into T  
}
{ Will also accept T.transpose (T)   
}
function TMatrix.Transpose (m : TMatrix) : TMatrix;
 raise EMatrixSizeError.Create ('Destination matrix has incorrect
dimensions for transpose');
  { If the user is trying to transpose itself }
tmp.Transpose (st);
Self.Transpose (ns);

This is the output when I try to compile:

[EMAIL PROTECTED] misc code]$ fpc -gl -S2 -Cr -Co mat.pas
Free Pascal Compiler version 1.9.4 [2004/05/30] for i386
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Linux for i386
Compiling mat.pas
mat.pas(85,41) Error: Duplicate identifier "M"
mat.pas(85,30) Error: Function is already declared Public/Forward
"TMatrix.transpose:TMatrix"
mat.pas(87,38) Error: Duplicate identifier "M"
mat.pas(89,38) Error: Duplicate identifier "M"
mat.pas(90,38) Error: Duplicate identifier "M"
mat.pas(91,30) Error: Function is already declared Public/Forward
"TMatrix.mult(Extended):TMatrix"
mat.pas(93,38) Error: Duplicate identifier "M"
mat.pas(103,40) Error: Duplicate identifier "M"
mat.pas(117,73) Error: Duplicate identifier "c"
mat.pas(118,48) Error: Duplicate identifier "r"
mat.pas(118,73) Error: Duplicate identifier "c"
mat.pas(119,59) Error: Duplicate identifier "r"
mat.pas(127,1) Fatal: There were 12 errors compiling module, stopping

Any ideas on getting fpc to compile this?  I'm confused by the
reference to 'm'? 

-Alan

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


Re: [fpc-pascal]Where is the error?

2004-08-31 Thread Alan Mead

--- Michalis Kamburelis <[EMAIL PROTECTED]> wrote:

> Solution is to compile in delphi mode:
>fpc -Mdelphi mat.pas
> works OK.

Thanks!  -Sd worked great... in fact FPC may produce better
diagnostics than Delphi..

-Alan

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


[fpc-pascal]Porter stemming routine for FPC

2004-09-03 Thread Alan Mead
Porter stemming is an approximate method for removing
English-language endings from words ... for example, to match 'happy'
and 'happiness'.  

I found a website on tartarus.org that purports to be Porter's
website and has a Delphi 5 implementation of his word stemming
algorithm.  But I cannot get it to compile because of errors in
inline asm code (about which, I know nothing).  So, I thought before
I rip that out and re-implement.. *if* I'm even capable... I would
check if anyone has already done so or otherwise has an
FPC-compatible Porter stemming routine that I could use.  

Alternatively, I also have a Perl version which looks simple enough
to port, it's a series of regex's.  But when I run testreg1.pp
compiled with 1.9.4 on Linux, it looks like regex support is broken: 
error near 1000 index:0 len:0 ... 

Many thanks,

-Alan

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


Re: [fpc-pascal]Porter stemming routine for FPC [solved]

2004-09-03 Thread Alan Mead
Ack!  After posting this, I actually read the code and discovered
that the author provided "pure pascal" alternative bits.  The unit
compiles without even a warning now.  Sorry.

-Alan

--- Alan Mead <[EMAIL PROTECTED]> wrote:

> Porter stemming is an approximate method for removing
> English-language endings from words ... for example, to match
> 'happy'
> and 'happiness'.  
> 
> I found a website on tartarus.org that purports to be Porter's
> website and has a Delphi 5 implementation of his word stemming
> algorithm.  But I cannot get it to compile because of errors in
> inline asm code (about which, I know nothing).  So, I thought
> before
> I rip that out and re-implement.. *if* I'm even capable... I would
> check if anyone has already done so or otherwise has an
> FPC-compatible Porter stemming routine that I could use.  
> 
> Alternatively, I also have a Perl version which looks simple enough
> to port, it's a series of regex's.  But when I run testreg1.pp
> compiled with 1.9.4 on Linux, it looks like regex support is
> broken: 
> error near 1000 index:0 len:0 ... 


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


[fpc-pascal]Keyboard unit questions

2004-09-10 Thread Alan Mead
I just used the keyboard unit for the first time and it's quite
impressive but I have some questions.

Initially, I couldn't link on my old RH 7.2 machine because FPC 1.9.4
couldn't find the GPM libraries.  This is probably a stupid question
but is there a way that FPC can find libraries better so that I don't
have to ln -s /usr/libgpm.so.1 to /usr/libgpm.so?  This has happened
with other FPC units...

Anyway, isn't GPM a mouse package?!? I didn't consult the unit's
source but I don't see any mouse functionality in the docs? Just
curious.

And finally, I pasted my little example program below.  When I run it
in Konsole and it has some funny behavior.  Like Shift-F2 is reported
as F4 and Control-U is reported as 'SHIFT' ^A and ^E don't seem to
have any text associated with them (maybe it's reporting a space?). 
I wanted to build a simple bash-like command history/editing and I
was going to use those but if I cannot read them...

In xterm it's slightly different... for example, ^A does nothing but
then the next charcter shows as SHIFT x (e.g., ^Aa shows as 'SHIFT
a') and Shift-F2 shows three keys.. 'Key with scancode 6144', 2, and
Q while Shift-F3 shows the same scancode and then 2,R.

I tried adding the shift state but that didn't change anything and
the shift states don't seem to be read accuractely (control and alt
are never read).

Thanks!

-Alan

program readline;

uses keyboard;

  procedure ReadKBD(var S: String);
var K : TkeyEvent;
begin
  InitKeyboard;
  Repeat
K:=GetKeyEvent;
K:=TranslateKeyEvent(K);
writeln(KeyEventToString(K));
  Until (GetKeyEventChar(K)='q');
  DoneKeyboard;
end;

var S:String;
begin
  ReadKBD(S);
end.


-Alan

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


Re: [fpc-pascal]Keyboard unit questions

2004-09-10 Thread Alan Mead

--- John Coppens <[EMAIL PROTECTED]> wrote:

> On Fri, 10 Sep 2004 08:33:21 -0700 (PDT)
> Alan Mead <[EMAIL PROTECTED]> wrote:
> 
> > I just used the keyboard unit for the first time and it's quite
> > impressive but I have some questions.
> > 
> > Initially, I couldn't link on my old RH 7.2 machine because FPC
> 1.9.4
> > couldn't find the GPM libraries.  This is probably a stupid
> question
> > but is there a way that FPC can find libraries better so that I
> don't
> > have to ln -s /usr/libgpm.so.1 to /usr/libgpm.so?  This has
> happened
> > with other FPC units...
> 
> Hi Alan.
> 
> Surely someone with more experience will correct me. But for
> starters:
> 
> libgpm.so.1 shouldn't be in /usr - it should be either in usr/lib
> or
> usr/local/lib. In that case, your machine will automatically do the
> link,
> when it executes ldconfig.

John, thanks for your reply... Sorry, I should have been clearer. 
And I typed wrong.  The library was in /usr/lib but I guess FPC is
looking for 'libgpm.so' rather than 'libgpm.so.1' .. it's the '.1'
that fools FPC and it's happened before.  I don't know if it's a
RedHat thing .. because /usr/lib/libgpm.so.1 is, itself, a sim link
to something like /usr/lib/libgpm.so.1.18.1.. I gather that's the way
that one reconciles having the version number in the shared library
while trying to let linkers find the libraries... I just wonder why
FPC doesn't understand... Maybe this is considered such a trivial
matter to people that can write compilers :) Or maybe this is an
incompatibility between Linux distro's and RH just loses?

[snip]
> > And finally, I pasted my little example program below.  When I
> run it
> > in Konsole and it has some funny behavior.  Like Shift-F2 is
> reported
> > as F4 and Control-U is reported as 'SHIFT' ^A and ^E don't seem
[snip]
> 
> Can't help you there. 

I've had other programs mis-behave... The command history bits of my
favorite text adventure game works fine in console mode but screws
things up when I'm in Konsole.  I spent a little while goggling
around about keyboards and character sets and X ... but X is probably
the area of Linux that I know the least and I didn't understand any
of the stuff I found.

-Alan

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


[fpc-pascal] How do I do this safely?

2004-10-15 Thread Alan Mead
I am trying to write code that will compile cleanly in current and
future versions of FPC (in mode Delphi) and Delphi on 32- and 64-bit
platforms.  I need to store strings and their floating point rankings
in a list and I was advised to use the single type and store them in
the TStringList.Objects list, using a cast to store and retreive the
values.  

SL := TstringList.Create;
rank := 0.95;
title := 'This is a string';
SL.AddObject(title,pointer(rank));

This feels unsafe.. I'd hate to have to come back later to debug why
the ranks have become completely garbled on a new platform or
version.

Should I convert ranks to an integer (slightly awkward)?  Or just
create a trivial class to hold ranks as objects (seems like
overkill)? Or...?

-Alan


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


[fpc-pascal] Known issue with 1.9.4 [2004/05/30] for i386 on Linux?

2004-09-28 Thread Alan Mead
I don't know if this is really a bug or whether it's known... I have
this line of code:

  while ( (i<=Length(fmt)) and (NOT fmt[i] IN ['0'..'9']) ) do
inc(i);

It compiles fine but I get a RTE:

An unhandled exception occurred at 0x0807B180 :
EVariantError : Invalid variant operation
  $0807B180
  $B980

Funny thing is, I enabled line numbers with '-gl'... And the error
message makes no sense to me.. After staring at that line of code for
a while, I put parens around the "fmt[i] IN ['0'..'9']" and all was
well:

  while ( (i<=Length(fmt)) and (NOT (fmt[i] IN ['0'..'9'])) ) do
inc(i);

So, that seems to be a bug to me... Shall I report it or is it known
(or am I wrong that it's a bug)?

-Alan

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


[fpc-pascal] Random(), Randomize, and Linux permissions

2004-09-28 Thread Alan Mead
It's known that Randomize() is not effective when called rapidly... I
tried to solve this using the code sample below.  I can cat /dev/null
(without becoming root) but when I run the code below I get an access
denied RTE at 'Reset(f,1);'.. this code works fine when run as
root... anyone have a suggestion? 

-Alan

  procedure SuperRandomize;
var
  f: file of cardinal;
  Card: Cardinal;
begin
Assign(f,'/dev/random');
Reset(f,1);
read(f,Card);
RandSeed := Card;
close(f);
end;

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


Re: [fpc-pascal] Random(), Randomize, and Linux permissions

2004-09-29 Thread Alan Mead
Thanks for all the suggestions.

Right, if my program were to execute cntinuously while it generated
these random numbers, it would be easy to just call randomize once. 
But my program runs very quickly and I'd like it to produce very
random numbers even upon repeated execution of the program.  If
nothing else, it's important for my testing of it.  As it stands, if
I run it repeatedy without much time between runs I don't just get
similar numbers, I seem to get the exact same sequence. I didn't time
it precisely, but I'd say you want about a second or more to elapse
between calls to Randomize() in order to get different sequences.

Hence my attempt to use /dev/urandom.  I had suggested this in a
discussion on this list about a year ago and I thought I would try to
implement it now...  I acknowledge the limitations of this approach..
maybe it would be easier to just stick a 1 sec delay before the
randomize :)

BTW, I meant to ask: IIRC, about a year ago someone mentioned that
2.0 would use the Mersenne Twister method.  Is that what's in 1.9.4? 
Last time I compared FPC's random() to MT, MT was a clear winner. 

-Alan

--- Jonas Maebe <[EMAIL PROTECTED]> wrote:

> 
> On 29 sep 2004, at 08:36, Alan Mead wrote:
> 
> > It's known that Randomize() is not effective when called
> rapidly...
> 
> Why do you want to call randomize rapidly? Reading a numbers from 
> /dev/random is semantically closer to calling random() a lot than
> to 
> calling randomize() a lot.
> 
> 
> Jonas
> 
> 
> ___
> 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


Re: [fpc-pascal] Known issue with 1.9.4 [2004/05/30] for i386 on Linux?

2004-09-29 Thread Alan Mead

Alan Mead <[EMAIL PROTECTED]> wrote:

> I don't know if this is really a bug or whether it's known... I
> have
> this line of code:
> 
>   while ( (i<=Length(fmt)) and (NOT fmt[i] IN ['0'..'9']) ) do
> inc(i);
> 
> It compiles fine but I get a RTE:
> 
> An unhandled exception occurred at 0x0807B180 :
> EVariantError : Invalid variant operation
>   $0807B180
>   $B980
> 
> Funny thing is, I enabled line numbers with '-gl'... And the error
> message makes no sense to me.. After staring at that line of code
> for
> a while, I put parens around the "fmt[i] IN ['0'..'9']" and all was
> well:
> 
>   while ( (i<=Length(fmt)) and (NOT (fmt[i] IN ['0'..'9'])) ) do
> inc(i);
> 
> So, that seems to be a bug to me... Shall I report it or is it
> known
> (or am I wrong that it's a bug)?

Thanks for the comments.  Perhaps I was unclear. There are three
reasons I am inclined to consider this a bug. 

First, it seems improper for any syntax to compile (i.e., to fail to
raise a syntax error) and then not execute. Ok, "a := 1/0;" might
compile but it seems like some type checking got lost here.  Maybe
there is am implicit conversion going on... At the least, I'd like
the compiler to flag this line with a warning.

Second, I had to track this down by inserting a bunch of lines like
"writeln('Passed 33');".  The code was compiled with -gl so I should
see a line number but none is shown.  This seems like a bug.  

Third, the RTE, "Invalid variant operation" seems inappropriate and
confusing.  Again, maybe there's an implicit conversion... (but is it
appropriate?)

-Alan

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


Re: [fpc-pascal] RE: Random(), Randomize, and Linux permissions

2004-09-29 Thread Alan Mead
Jeff,

Thanks for this link.  I found a Pascal implementation of MT
somewhere .. not this one I think.  Is it your code?  Do you know the
difference between the Real1() and Real2() etc. methods?

I was hoping that the algorithms underlying the RTL.Randomize and
RTL.Random would switch to using MT in fpc version 2.

-Alan

--- Jeff Pohlmeyer <[EMAIL PROTECTED]> wrote:

> 
> > Last time I compared FPC's random() to MT, MT was a clear winner.
> 
> Have you tried this ?
>   http://daniel.taickim.net/development/mtwister.pp
> 
> 
> 
> 
>   
> __
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!
> http://promotions.yahoo.com/new_mail
> 
> ___
> 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


Re: [fpc-pascal] RE: Random(), Randomize, and Linux permissions

2004-09-29 Thread Alan Mead
Alan Mead <[EMAIL PROTECTED]> wrote:

> I was hoping that the algorithms underlying the RTL.Randomize and
> RTL.Random would switch to using MT in fpc version 2.

Here's the post I recalled:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg01565.html

Is this still the case that 1.9.x implements MT?  Hmm.  As, I recall,
MT beat FPC's 1.x random() in my testing using "ent"... I'll have to
take a look again.

-Alan

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


[fpc-pascal] -gl -Co as compiler directives?

2004-10-18 Thread Alan Mead
Are there a source-code directives to generate line numbers and check
overflows?  I compile my code on several systems and it's a lot more
convenient enabling or disabling these in the code.

-Alan

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


Re: [fpc-pascal] -gl -Co as compiler directives?

2004-10-18 Thread Alan Mead
Thanks!

However, lininfo doesn't seem to be working in 1.9.4 (it seems to be
included but it does not duplicate the behavior of -gl in that line
numbers are NOT shown when there is an exception).

Is this maybe a more recent addition?  Or am I confused?

Thanks again.

-Alan

--- Jonas Maebe <[EMAIL PROTECTED]> wrote:

> 
> On 18 okt 2004, at 19:14, Alan Mead wrote:
> 
> > Are there a source-code directives to generate line numbers
> 
> Not directly, although although you can get the same effect by
> using
> 
> {$d+}
> uses lineinfo;
> 
> (as long as you want the equivalent of -gl, and not of -g-l)
> 
> > and check overflows?
> 
> {$q+}
> 
> 
> Jonas
> 
> 
> ___
> 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


Re: [fpc-pascal] Encrypt routine

2004-10-26 Thread Alan Mead
I believe that Free Pascal comes with a package, idea, that does
encryption.  If you just want to avoid casual viewing, you might try
just compressing the data using TCompressedStream.

-Alan

--- Luiz Américo <[EMAIL PROTECTED]> wrote:

> I'm looking for a simple file encryption routine (or an external
> library).
> Something like:
>Procedure EncryptFile(FileName,Key:String);
>Procedure DecryptFile(FileName,Key:String);
> 
> I'd be glad with someone help
> 
> Luiz


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


[fpc-pascal] Cross-platform gdbm replacement

2004-10-27 Thread Alan Mead
I need to have some simple, cross-platform database functionality...
at a minimum, I need to be able to write a datafile that is easily
searched... kind of like a TStringList on disk.  I think dbm/gdbm
would suffice.  If it had the ability to hold multiple columns and
several indexes to those columns, that would be even better.  I've
considered something like MySQL but my needs are light-weight and I
need a permissive license so it can be included with a commercial
program and without having a seperate install/config.  And it needs
to work with FPC and Delphi.

I'll never need to use SQL or do a join.. the 'where' part will
always be a simple field value.  I will need to search a few million
records quickly.  Again, I need a way to write/rewrite the entire
datafile once and if the indexes get corrupted, I might need to
reindex.  But basically, I'll only be reading from this data.

I looked at Delphi's TDataSet class and descendants briefly but that
seems pretty complicated... I don't know if it's available in FPC.

Is this available in an existing package?  If not, I think it
wouldn't be more than a few nights hacking to make this degree of
functionality...  In fact, if it comes to that I'm torn between
starting from scratch with my own format or trying to adapt Turbo
Pascal code that can access existing file formats (e.g., Clipper).

Any thoughts or solutions would be appreciated.

-Alan

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


[fpc-pascal] Strange exception

2004-10-28 Thread Alan Mead
I compiled a program using -gl with FPC 1.9.4 on Linux and I get this
run-time-error when running the program:

An unhandled exception occurred at 0x080742B2 :
ERangeError : Range check error
  $080742B2  SVDCMP2,  line 337 of lsa2.pas
  $B924  P$LSA2_finalize_implicit,  line 692 of lsa2.pas

What makes it strange is that line 337 is the final end statement of
the procedure SVDCMP2 and line 692 is the final end statement of the
program lsa2.  Any ideas what might cause this or what to do?

-Alan

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


Re: [fpc-pascal] Strange exception

2004-10-28 Thread Alan Mead
I have 1.9.5 installed on a second computer.  When I compile using
the newer version, I get a slightly different error message:

An unhandled exception occurred at 0x0807498D :
ERangeError : Range check error
  $0807498D  SVDCMP2,  line 337 of lsa2.pas
  $0001

-Alan

--- Alan Mead <[EMAIL PROTECTED]> wrote:

> I compiled a program using -gl with FPC 1.9.4 on Linux and I get
> this
> run-time-error when running the program:
> 
> An unhandled exception occurred at 0x080742B2 :
> ERangeError : Range check error
>   $080742B2  SVDCMP2,  line 337 of lsa2.pas
>   $B924  P$LSA2_finalize_implicit,  line 692 of lsa2.pas
> 
> What makes it strange is that line 337 is the final end statement
> of
> the procedure SVDCMP2 and line 692 is the final end statement of
> the
> program lsa2.  Any ideas what might cause this or what to do?
> 
> -Alan
> 
> ___
> 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


Re: [fpc-pascal] Strange exception

2004-10-29 Thread Alan Mead

--- Peter Vreman <[EMAIL PROTECTED]> wrote:
> >> An unhandled exception occurred at 0x080742B2 :
> >> ERangeError : Range check error
> >>   $080742B2  SVDCMP2,  line 337 of lsa2.pas
> >>   $B924  P$LSA2_finalize_implicit,  line 692 of lsa2.pas
> >>
> >> What makes it strange is that line 337 is the final end
> statement
> >> of
> >> the procedure SVDCMP2 and line 692 is the final end statement of
> >> the
> >> program lsa2.  Any ideas what might cause this or what to do?
> 
> There is a variable that needs to be finalized since it contains
> refcounted types.

Peter, 

Thanks!

I don't understand what you mean by "finalize".. how do I find out
which variable isn't being finalized and finalize it?  Is that
something I do or that the compiler adds code to do?

I've narrowed down where the error occurs and I think it's just a 201
error that occurs on line 250 (line 249 executes, then I get the
exception and line 251 does not execute)... so I don't know why line
337 or" finalization" is involved.

-Alan

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


[fpc-pascal] Find error?

2004-11-09 Thread Alan Mead
Turbo Pascal used to have a "find error" function... Is there a
similar function in Free Pascal (I'm using 1.9.4)?  I compiled the
executable with -gl but I get the below:

An unhandled exception occurred at 0x08071049 :
EOutOfMemory : Out of memory
  $08071049
  $080705FD
  $08068B2A
  $08068E30
  $4D664F74  P$LSA2_finalize_implicit,  line 683 of lsa2.pas

-Alan

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


re: [fpc-pascal] Find error?

2004-11-09 Thread Alan Mead
Thanks David, Pete amd Florian,

When I try Peter's advice, I get 

(gdb) info line 0x08071049^
Function "0x08071049" not defined.

I found the section of the FPC User's Manual that talks about gdb and
I assumed that I hadn't used the '-g' option ... but now I'm
wondering if '-gl' should allow gdb debugging?  The docs on gdb seem
pretty volumnous but I didn't see 'info' as a command...

Regarding the EOutOfMemory exception, is that thrown only when all
(physical+virtual) memory is exhausted?  Or is it also possible to
try to allocate too big a chunk (say, a chunk that exceeds physical
but not physical+virtual)?  I'm running FC1 with the 2.4 kernel
(although I may upgrade to FC2 with the 2.6 kernel).

-Alan

--- David Emerson <[EMAIL PROTECTED]> wrote:

> When you compile with -gl you need to make sure that you recompile
> all the units, as well as the main program, with the -gl flag.
> Passing a -B flag will recompile all units (whose sources are found
> in the path), so:
> fpc -gl -B myprogram
> 
> If, after doing so, you still lack line info, it's probably because
> it's hitting an error in the rtl or some other part of the fpc
> system, in which case you ought to be able to trace the erroneous
> call back to the last call made by your code.
> 
> If you'll be running in debug mode for any appreciable length of
> time, you might consider putting -gl in your fpc.cfg, so fpc will
> always compile all your programs with the line info. The drawback
> is that the executables are bigger; I don't know if there are any
> speed considerations.
> 
> Of course, as Peter suggested, you could also use the IDE or
> Lazarus or some other gdb-supporting editor, which can take you
> straight to the error from the address, rather than needing the
> line info in english.
> 
> ~David.
> 
>   Original Message 
> > From: Alan Mead <[EMAIL PROTECTED]>
> > Sent: Tuesday, November 09, 2004 8:58 AM
> > To: free pascal <[EMAIL PROTECTED]>
> > Subject: [fpc-pascal] Find error?
> > 
> > Turbo Pascal used to have a "find error" function... Is there a
> > similar function in Free Pascal (I'm using 1.9.4)?  I compiled
> the
> > executable with -gl but I get the below:
> > 
> > An unhandled exception occurred at 0x08071049 :
> > EOutOfMemory : Out of memory
> >   $08071049
> >   $080705FD
> >   $08068B2A
> >   $08068E30
> >   $4D664F74  P$LSA2_finalize_implicit,  line 683 of lsa2.pas
> > 
> > -Alan
> > 
> > ___
> > 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
> 



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


[fpc-pascal] Monitoring memory usage

2004-11-09 Thread Alan Mead
Is there an easy way to monitor memory allocations during a program
run (for debugging purposes)?  

Ideally, this would be some sort of hook into the memory manager
rather than something like gdb because the program runs for hours.  

A list of the calling subroutine (or line number) and the amount
allocated/deallocated, that would be quite helpful.  

I think I can trace most of the memory being allocated manually but
I'd like an auditing mechanism to verify.

Thanks!

-Alan

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


Re: [fpc-pascal] Monitoring memory usage

2004-11-10 Thread Alan Mead
Thanks for everyone, I'll tae a look at this.

-Alan

--- Mattias Gaertner <[EMAIL PROTECTED]> wrote:

> On Wed, 10 Nov 2004 08:46:21 +0100
> Florian Klaempfl <[EMAIL PROTECTED]> wrote:
> 
> > Alan Mead wrote:
> > 
> > > Is there an easy way to monitor memory allocations during a
> program
> > > run (for debugging purposes)?
> > 
> > I guess the easiest is using the heaptrc unit and modifying it
> for your 
> > needs.
> 
> See lazarus: components/codetools/memcheck.pas
> The include file (memcheck_laz.inc) contains the added features:
> 
> procedure CheckHeap;
> procedure CheckHeap(const txt: ansistring);
> procedure CheckHeapWrtMemCnt(const txt: ansistring);
> procedure WriteGetMemCount(const txt: ansistring);
>  
> function MemCheck_getmem_cnt: longint;
> function MemCheck_freemem_cnt: longint;
> function MemCheck_getmem_size: longint;
> function MemCheck_freemem_size: longint;
> function MemCheck_getmem8_size: longint;
> function MemCheck_freemem8_size: longint;
> 
> You may want to change the longints to int64.
> 
> Mattias
> 
> 
> > 
> > > 
> > > Ideally, this would be some sort of hook into the memory
> manager
> > > rather than something like gdb because the program runs for
> hours.  
> > > 
> > > A list of the calling subroutine (or line number) and the
> amount
> > > allocated/deallocated, that would be quite helpful.  
> > > 
> > > I think I can trace most of the memory being allocated manually
> but
> > > I'd like an auditing mechanism to verify.
> > > 
> > > Thanks!
> > > 
> > > -Alan
> > > 
> > > ___
> > > 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
> 
> ___
> 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


[fpc-pascal] Linux stack wigginess on 1.9.4/1.9.5

2004-12-03 Thread Alan Mead
I saw someone recently say that there were some known issues with the
stack on recent version of FPC for Linux.  I'm wondering if what I've
found was known or new.

I have a lengthy program that compiles fine but crashes if I allocate
too much local storage in a procedure (a large array).  Switching to
open arrays solves my problem but I discovered this oddness with the
stack checking.  A small test program I wrote to try to replicate the
error crashes normally ("Run-time error 202 at $xx"), but my
longer program crashes like this:

An unhandled exception occurred at 0x0807EB79 :
Exception : Unknown Run-Time error : 202
  $0807EB79
  $08085F92  DOSIM,  line 265 of sim.pas
  $BB18  P$GE_finalize_implicit,  line 412 of sim.pas


This happens identically in 1.9.4 and 1.9.5.  I can share the source.
It's 411 lines but the bits that make it crash are pretty clear.

-Alan

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


[fpc-pascal] Win32 CGI fails?

2005-01-24 Thread Alan Mead
On Linux, FPC creates nice CGI's but I cannot figure out what I'm
doing wrong under Windows XP. Below you can see the error.  This is
on the FCL test CGI program.  I ran this under Cgywin, but the same
thing happens when I run it in a DOS command window (and, apparently,
under Apache).  I don't have the details, but the same error occured
under FPC 1.9.4.

I just searched for "cgi fpc EAccessViolation" and found nothing... 
I don't know how to proceed.  The fact that the line number is not
shown means that the error isin the FCL or RTL or some other
pre-compiled part, right?

-Alan

[EMAIL PROTECTED] ~/cgi
$ fpc -Cr -Co -gl testcgi.pp
Free Pascal Compiler version 1.9.6 [2004/12/31] for i386
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Win32 for i386
Compiling testcgi.pp
Linking testcgi.exe
60 Lines compiled, 0.5 sec

[EMAIL PROTECTED] ~/cgi
$ ./testcgi
An unhandled exception occurred at 0x00411276 :
EAccessViolation : Access violation
  $00411276
  $0006FFE0
  $0006FEC8
  $00080178
  $000AB338


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


[fpc-pascal] Porter Stemming for FPC 2.0

2005-09-16 Thread Alan Mead
It's great that 2.0 is out!  Unfortunately it seems to break some
code I used for Porter Stemming because the code sometimes reads data
from a pchar at negative indexes.  Reportedly this works fine in
Delphi 5 and I don't seem to have trouble with Delphi 7 but it
generates RTEs using fpc 2.0.  (If this is a FAQ, forgive me, I've
been away from Free Pascal for a while...)

So, here is a file containing my patched code and a test program that
seems to run fine:

http://www.alanmead.org/downloads/fpc2_PorterStem.zip

The homepage for this algorithm, which may offer my fix someday, is
here:

http://www.tartarus.org/~martin/PorterStemmer/

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


Re: [fpc-pascal] Porter Stemming for FPC 2.0

2005-09-19 Thread Alan Mead
memsom <[EMAIL PROTECTED]> wrote:

> Reading PChars at negative indexes? Buffer underrun in other
> words... This
> is absolutely not a good thing. If FPC is preventing buffer under
> and
> overrruns, then it is actually right, for once, and Delphi is
> wrong,
> wrong, wrong!

Yeah, it seems dumb.  Well, I'm more a Turbo Pascal than a Delphi
programmer and not a software professional.  I don't actually know
what a pchar is...  I guess it's a pointer to a strong that was added
to Delphi to talk to the Windows API?

Anway, if you look at this guy's code, I'm convinced that he falls
into the "power user" category.  He has no problem writing ASM but he
also provides a a "pure Pascal" solution (chosen at compile-time). 
And he's apparently benchmarked his code and is agressively trying to
optimize it.

And it's not a buffer under-run per se.  He's checking the ends of
words against a series of word endings.  He calculates a negative
index when he checks a long ending like '-ization' against a short
word like 'word' ... he calculates that he has to start checking
character -3 of 'word' [length('word'-length('ization')] ... The
outcome of this checking is "true, the word ends in the ending" or
"false" and of course 99% of the time it's false.  I think it's
impossible that he could get a wrong result because even if the
garbage at memory p[-3] to p[-1] matches the word ending, the word
itself will not.

So, I mention all this because it is an obscure point of
incompatibility between FPC 2.0 and Delphi 5-7 (and FPC 1.x) ... In
my case, this code worked fine and then it broke... just turning off
range-checking isn't an answer for me, as I need $R+ to catch my own
errors.  Luckily, it was easy enough to wrap IF statements around
these bits.

> A question... how do you know the memory at the negative index is
> valid?

I've explained why garbage won't goose the algorithm.  As to why it
does not GPF, I suppose this pchar is always pointed into the
"middle" of the data segment and the negative indices are always
single digits.  In the zip file containing my fix, I included the
test program that drives this guy's unit and the test data.  It
compiles and runs fine in Delphi 7 (you may have to comment out the
"{$mode DELPHI}") on the test data.

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


[fpc-pascal] What is the portable approach?

2005-09-30 Thread Alan Mead
I have data that would fit an associative array if they really
existed in Pascal, but while the key is a string, the values are
reals [0,1].  So, I have been using a TStringList and something like
(from memory):

MyList.AddObjects('key1',pointer(round(value1*maxint));

I realized that someday I might get burned on a 64-bit machine ...
now (using 2.0) I am reminded of this each time I compile.

So.. what's the portable method?  I could declare a real on the heap
and store the pointer to it.  Or I could write an object to hold the
real and instansiate a new object when I add a record?  Or I could
store the values as text using the psuedo-associate properties of
TStringList?

All these seem clunky... I can esily imagine the first two options
resulting in nasty null pointer run-time errors; they at least double
the amount of space I'm using; and I imagine they will be far slower
(I have a program that spends 20% of it's time allocating little tiny
records on the heap). Using text to store a real seems clearly wrong.

Is one of them the right/accepted/guru way to do it?  Or am I missing
an alternative?  Should I be thinking of extending the TStringList
class?

Thanks!

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


Re: [fpc-pascal] Re: What is the portable approach?

2005-10-04 Thread Alan Mead
--- L505 <[EMAIL PROTECTED]> wrote:

> 
> 
> > AM> I have data that would fit an associative array if they 
> > AM> really existed in Pascal
> > 
> > I remember spotting this in the "Contributed Units" section,
> > although I don't know if it will suit your needs:
> >   http://www.behrenhoff.de/pascal/hash.zip

[snip]

> Interesting - let us know if it works out.

I really appreciated Jeff's note.  But I think this unit only stores
text strings and values--already better supported, syntactically, by
the psuedo-associative "trick" behavior of string lists:

MyHash := TStrubglist.Create;
MyHash['Alan'] := 'Mead';

I also have to admit being worried by some of the code... like the
lack of error checking (as noted by the author).

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


Re: [fpc-pascal] FPCUnit article/tutorial online.

2005-10-11 Thread Alan Mead
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> The Editor of Toolbox Magazine has allowed me to put an article
> about FPCUnit online.
> [...]

I found the article and the discussion on this list very helpful. 
Thanks for writing it and making it available.

These are probably stupid questions, but all the examples I've read
about use silly tests like 1+1=2 or checking that a list is empty.
I'm having trouble seeing how I would write tests for my code.

I have an ugly little hack that reads some logged data and counts
certain things.  The code is fragile so I'd love to add unit
testing...  But the code is mostly procedures for reading and parsing
the log data.  Would the unit tests create fake input and compare it
to known output?  (How do I fake reading data from disk?)  For that
matter, how do I test the data-reading procedures?  (Write fake data
and then see if the routine reads it correctly?)

Or, I've been messing around with SQLite... to add unit tests for
this code, would I need to create fake databases?

And what about the GUI code?  How can that be tested?  

Thanks again for the article and stimulating discussion.

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


[fpc-pascal] Anyone have Windows CGI working?

2005-10-24 Thread Alan Mead
I have never had trouble on Linux but on Windows I have never gotten
the FCL example program testcgi.pp to work, not even from the command
line.  It dies when trying to initialize the CGI application (see
below).  Has anyone been successful in writing CGI applications for
Windows?  What's the "trick?"

[EMAIL PROTECTED] /cygdrive/c/FPC/2.0.0/examples/fcl
$ fpc -gl testcgi.pp
Free Pascal Compiler version 2.0.0 [2005/05/08] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: Win32 for i386
Compiling testcgi.pp
Linking testcgi.exe
61 Lines compiled, 0.5 sec

[EMAIL PROTECTED] /cygdrive/c/FPC/2.0.0/examples/fcl
$ ./testcgi
An unhandled exception occurred at $00401BB6 :
EAccessViolation : Access violation
  $00401BB6
  $004176C8
  $004175B9
  $00417246
  $0040857F
  $00407F0D
  $004015F3  main,  line 56 of testcgi.pp

(In case your curious whether this works in Apache's CGI environment:
No.  The error says "malformed header from script" because it's
returning the error message above.  Also, I get the same errors
whether I execute in Cygwin or the Command Prompt.)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Cross-platform lightweight/fpc SQLite bindings?

2005-10-25 Thread Alan Mead
I just want some fairly light-weight sqlite3 bindings that work on
Linux and Windows.  The code on the SQLite website works great on
Windows but fails to compile on Linux.  (I don't know Windows API
calls... it looks like he's searching for a function name in the
DLL.) 

I've tried a few other solutions and they have either not worked
cross-platform or they are meant for Delphi and I couldn't compile
them using just FPC.  

[I could use Lazarus... Is it easy to learn to use TDataSet?  My
ideal would be something like Perl's DBI... prepare(), execute(),
fetch_row(), etc.  I know SQL and don't need a lot of abstractions
getting in the way.]

Before I try to debug one of these non-working-solutions, does anyone
know of an existing FPC (not Delphi/Lazarus) solution that works on
both Windows and Linux?

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


Re: [fpc-pascal] Cross-platform lightweight/fpc SQLite bindings?

2005-10-25 Thread Alan Mead
Luiz, thanks!  A couple questions below...

Luiz Américo <[EMAIL PROTECTED]> wrote:

> Alan Mead wrote:
> > I just want some fairly light-weight sqlite3 bindings that work
> on
> > Linux and Windows.  The code on the SQLite website works great on
> > Windows but fails to compile on Linux.  (I don't know Windows API
> > calls... it looks like he's searching for a function name in the
> > DLL.) 
> 
> Are you failling to compile the sqlite library itself or the fpc
> binding 
> (sqlite3.pas)?
> The fpc binding does not depend of an other library except the
> sqlite itself

On both Linux and Windows, I'm using the binary libraries from
sqlite.org.  The bindings themselves fail to compile.  It looks like
a Windows-specific call is being used.

> > know of an existing FPC (not Delphi/Lazarus) solution that works
> on
> > both Windows and Linux?
> 
> At the time i tested, both the binding and the TDataset were
> working in 
> Linux and Windows, but were a change in the binding later. I'll
> take a look.

I'll give it a shot and I'll post here if I run into trouble.

The Wiki says that the bindings work with >= 2.83 ... does that
include 3.x?  Or do I need to go get the bindings below?

> 
> You can find the newest units for sqlite3 in the svn repository:
> 
> base sqlite3 (binding):
>
http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/packages/base/sqlite/sqlite3.pp
> 
> TDataset descendants
>
http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/customsqliteds.pas
>
http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/fcl/db/sqlite/sqliteds3.pas


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


Re: [fpc-pascal] Learning new things in an imperfect world

2005-11-01 Thread Alan Mead
David Chandler <[EMAIL PROTECTED]> wrote:

> I am having trouble getting a standard top-of-the-page menu system
> to 
> work properly in Lazarus (Version 0.9.10 beta downloaded a few
> weeks ago).

I think you'll get more help with this on the Lazarus mailing list.

I think when you get results that don't make sense... like compiling
an example program and having it not work properly, then you don't
need to assume it is your own ignorance.

> --The strange thing is that when I exit the Lazarus development 
> environment and run the exe file, they all (the example program and
> my 
> test programs) work flawlessly.  The problem seems to be in Lazarus
> 
> being able to run its own code.

The problem of paths isn't unique to Lazarus ... I've had similar
problems in the old BP IDE.  And again the folks on the Lazarus
mailing list will be better equipped to lend a hand.

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


[fpc-pascal] for..in loops?

2005-11-18 Thread Alan Mead
I use Perl a lot so the new for..in loops in Delphi caught my eye:

program ForIn;
type TStringArray = array of String;
procedure Demo1(const List: TStringArray);
var S: String;
begin
  for S in List do writeln(S);
end;
var sa: TStringArray;
begin
  Demo1(sa);
end.

fpc 2.0.0 doesn't compile this... are "for..in" loops in a newer
version or will they be sometime soon?  Here is a little blurb about
it from Google's cache:

http://66.102.7.104/search?q=cache:jti97cSprR0J:homepages.borland.com/dthorpe/blog/delphi/2004_08_01_archive.php%3Fshow_id%3D109211211041479238+freepascal+%22for+in%22+loop&hl=en

I'm still using Delphi 7... so it's not clear if this is already
available or in the new Delphi 2006 available next year...

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


Re: [fpc-pascal] for..in loops?

2005-11-19 Thread Alan Mead
I was also wondering HOW it would be done, but I just assumed that
everything was easy for you guys :)

Would it be hard for the compiler to try to automatically convert
this new construct into an equivalent older one? .. So when it finds 

for S in ArrayOfInteger do ...

it silently converts it to 

for i := 0 to {Count} do
  begin
S := ArrayOfInteger[i];
...

?  I don't know enough about the internals to know how hard it is to
know the limits of the array and the type...

I'd have to agree though, that this isn't a big deal one way or the
other.  One note:  The D2006 marketing materials (AFAICT) suggest
that this isn't just a .NET thing.

-Alan

--- Marco van de Voort <[EMAIL PROTECTED]> wrote:

> > On Fri, 18 Nov 2005 13:18:40 -0800 (PST)
> > Alan Mead <[EMAIL PROTECTED]> wrote:
> > 
> > > fpc 2.0.0 doesn't compile this... are "for..in" loops in a
> newer
> > > version or will they be sometime soon?  Here is a little blurb
> about
> > 
> > FPC will never support this, AFAIK. It doesn't really add
> anything new, it
> > just shortens the code somewhat. Only in toy examples is it nice,
> in
> > practice it doesn't really matter. We should try to keep the
> language as
> > small and clean as possible.
> 
> Note that part of this is quite elegant on .NET since basically is
> an
> object, and so everything can support some iterator interface, and
> the JIT
> can optimize a lot overhead away.
> 
> It doesn't work that way in native, and needs lots of expensive
> helpers, iow
> supporting it is a hack. Note that Perl is also OOP to a higher
> degree with
> JIT.
> 
> This is the problem with a lot of new Delphi.NET syntax. It might
> be
> backportable to native, but it feels "odd". The .NET generics have
> similar
> issues.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 

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