Re: [fpc-pascal] New Get Lazarus Initiative

2015-02-05 Thread Roland Schäfer
Dear fpc-pascal,

On 02/05/2015 12:00 PM, fpc-pascal-requ...@lists.freepascal.org wrote:
 Date: Wed, 4 Feb 2015 17:43:09 -0500
 From: Anthony Walter sys...@gmail.com
 To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
 Subject: Re: [fpc-pascal] New Get Lazarus Initiative
 
 Ralph, not to be rude, but you are either not paying attention or being
 dense. I said:

I don't know what the problem of this community is, but since this list
has once again been used (EXTENSIVELY, I might add) for stuff that
belongs on fpc-other, and the tone is so often a very unpleasant one, I
am leaving it. It definitely sucked being laughed at at conferences for
writing larger projects in FPC Pascal, but this list sucks worse!

For me, the new Get Lazarus initiative was a highly successful
Finally stop using FPC! initiative. IMHO, the only initiative you need
(that doesn't exist yet) is an FPC foundation to ensure long-term
compiler development.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] TGZStream and Int64-sized streams

2013-06-10 Thread Roland Schäfer
Hi all,

I'm wondering if anyone is maintaining TGZFileStream, because TStream
has Int64-typed Position, Size, and Seek-Offset, and I need this in
TGZStream for some large files I process. Any solutions?

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


Re: [fpc-pascal] OT: Amazing new development tools

2012-02-26 Thread Roland Schäfer
That was the seventh message on a subject which is not related to FPC in
any recognizable way. Although not a very frequent poster, I still need
to be on this list because I chose FPC for some of my professional work,
and I usually learn a lot from following some of the discussions on the
list. Why does this type of discussion not go on fpc-other?

I know I'm not a moderator or anything. I am just very busy and really
just beg you to respect my decision to be on the fpc-pascal list and
not visions-other.

Thanks,
R.

On 2/26/2012 12:35 PM, ik wrote:
 On Sun, Feb 26, 2012 at 13:25, zeljko zel...@holobit.net wrote:
 and that tables can contain billion of rows ... so visualisation won't be so
 snappy :)
 
 It depends on your tests. That visualization is for test driven
 development (http://en.wikipedia.org/wiki/Test-driven_development).
 
 In Ruby I use Cucumber for such things, and then you can provide also
 a table with possible values to see how it will react.
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Roland Schäfer
On 10/18/2011 8:10 PM, Andrew Pennebaker wrote:
 Sokol, I'm writing a function GenArray(generator) that returns a random
 array populated by calling the generator function. So the return type of
 GenArray matches array of the return type of the generator function, for
 any generator function.
 
 E.g., GenArray(GenChar) would return a random string. (Except I don't know
 the syntax for passing function pointers.)

Sven pointed out yesterday that you cannot achieve in FPC what you want
to achieve. (I haven't used Delphi in a long time and don't know what
exactly anonymous functions are in Delphi, but I strongly tend to trust
his word.) You can't get anonymous but only typed function pointers
(cf. also Lukasz mail, second to last paragraph, plus his short mail).

Since you were asking for hacks... By way of satire(!): To bypass the
need to explicitly define a function type for each data type, you could
give up on types and write a lot of functions like

function GenChar : Pointer;
function GenString : Pointer;

The type of all of those can be given as

type TGen = function : Pointer;

Generator would have to return an array of Pointer in this scenario.
Then, you could hack your way on from there. Please don't mention my
name, though.

However, if you're just asking about the syntax for procedural types,
the Language reference guide for FPC 2.4.4, section 3.6 (p. 45) has
all the details: http://www.freepascal.org/docs.var

 Maybe you could fork my code 

Out of curiosity: Is that the impersonal you?

 and use templates to achieve this?

Generics are currently for classes only, as chapter 8 (p. 87) of the
aforementioned reference guide explains.

Best,
Roland

 On Tue, Oct 18, 2011 at 4:57 AM, Lukasz Sokol el.es...@gmail.com wrote:
 
 On 17/10/2011 21:53, Andrew Pennebaker wrote:
 Does Free Pascal have anonymous functions that you can pass around,
 e.g. to a sort(compare : function, arr : array) function?

 If not, does anyone know any hacks to accomplish this?

 Cheers,

 Andrew Pennebaker www.yellosoft.us http://www.yellosoft.us


 Yes:

 //you can declare a type :

 TMyFunction: function(AMyParam : TType): TOtherType;

 // then implement:

 function MyFunctionWithArbitraryName(AMyParam: TType): TOtherType;
 begin
  {do something with AMyParam}
 end;

 //then (or before, if the TMyFunction is in type declaration section)

 function AFunctionUsingTMyFunctionAsArgument(AFunction :
 TMyFunction):TWhateverType;
 var OtherReturn: TOtherType;
AParameterToAFunction : TType;
 begin
  {some code}
  OtherReturn := AFunction(AParameter);
  {other code}
 end;

 // and finally even
 const   MYFUNCTIONCOUNT = 1
ArrayOfTMyFunction = array[0..MYFUNCTIONCOUNT-1] of TMyFunction =
 (MyFunctionWithArbitraryName);
{it's a static array, so
 match the number of elemets}

 begin
  for {declared somewhere global} i := 0 to MYFUNCTIONCOUNT-1 do
WhateverReturn :=
 AFunctionUsingTMyFunctionAsArgument(ArrayOfTMyFunction[i](MyParam));

 end.

 (Terms and conditions : this is invoked from /dev/mem, some syntax
 discrepancies may occur
 as my attention moved on from this as it obviously worked)

 I have written a dumb CLI interpreter this way ;) recently.
 (the function table contains command name as string in a record together
 with the function
 and the main procedure looks for the name and executes the arbitrary
 function when found)

 TMyFunctionRecord = record
  CLIName: string;
  MyFunction : TMyFunction
 end;

 const ArrayOfCLIFunctions = array[0..CLIFUNCCOUNT-1] of TMyFunctionRecord =
 ({...});

 var CLIFunctionToExecute : TMyFunction;
WhateverReturn : TWhateverType;

 begin
  for i := 0 to CLIFUNCCOUNT-1 do
if ArrayOfCLIFunctions[i].CLIName = paramstr[1] then
  begin
CLIFunctionToExecute := ArrayOfCLIFunctions[i].MyFunction;
break;
  end;
  WhateverReturn :=
 AFunctionUsingTMyFunctionAsArgument(CLIFunctionToExecute(MyParam));
 end.


 Also the 'anonymous' functions can be implemented in a separate unit which
 only exports the
 /relevant/ ones in its interface section.

 The obvious limitation / safeguard is : you must use the function of
 declared type to pass into
 the function AFunctionUsingTMyFunctionAsArgument(AFunction : TMyFunction)
 and no other type;
 (An obvious workaround to that is to use varargs ;) but I did not try that
 so I can't tell
 whether that would work)

 It's not much OOP in action (and may have {obvious for some //not me}
 performance penalties but oh well. ;)

 L.

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


Re: [fpc-pascal] Any command line interpreters for Free Pascal?

2011-10-15 Thread Roland Schäfer
I get the impression that you want to use Pascal for something it wasn't
designed for. Even if you can find some kind of solution, it will
probably be a bad hack. But that question is probably for fpc-other.

So anyway, the only solution I can think of is to automatically comment
out the shebang by calling sed or something from your makefile if you
compile as a program. (As fas as I understand, this is exactly
equivalent to what instantfpc does in the background, since it is NOT an
interpreter. So what you do is in fact make a lot of fuss about two
different ways of generating and running exactly the same executable.)
You can even remove the comment after compilation again. This is as bad
style as using the old #if 0 construction for debug code in C, though.

Good look,
Roland

On 10/15/2011 12:56 AM, Andrew Pennebaker wrote:
 Yeah, I know to chmod my scripts before dot-slashing them. It's just that
 fpc can't handle shebangs, and I don't want to have to choose either
 scripting or compiled. I like my Pascal code to be work in either mode.
 
 Cheers,
 
 Andrew Pennebaker
 www.yellosoft.us
 
 On Fri, Oct 14, 2011 at 6:49 PM, ik ido...@gmail.com wrote:
 
 On Sat, Oct 15, 2011 at 00:48, ik ido...@gmail.com wrote:

 On Sat, Oct 15, 2011 at 00:43, Andrew Pennebaker 
 andrew.penneba...@gmail.com wrote:

 Thanks ik. Merf, it appears fpc can't compile when a shebang is added. In
 future versions, can fpc treat shebangs as comments so that instantfpc code
 could be compiled like normal Free Pascal code?

  $ cat hello.pas
 #!/usr/bin/env instantfpc
 program Hello;
 begin
 writeln('Hello World!')
 end.


 $ chmpd +x hello.pas


 Opps,
 $ chmod +x hello.pas


  $ ./hello.pas




 $ fpc hello.pas
 Free Pascal Compiler version 2.4.4 [2011/05/01] for i386
 Copyright (c) 1993-2010 by Florian Klaempfl
 Target OS: Darwin for i386
 Compiling hello.pas
 hello.pas(1,1) Error: Illegal char constant
 hello.pas(1,2) Fatal: Syntax error, BEGIN expected but const string
 found
 Fatal: Compilation aborted
 Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you
 did not specify a source file to be compiled)

 Cheers,

 Andrew Pennebaker
 www.yellosoft.us

 On Fri, Oct 14, 2011 at 6:29 PM, ik ido...@gmail.com wrote:


 On Sat, Oct 15, 2011 at 00:25, Andrew Pennebaker 
 andrew.penneba...@gmail.com wrote:

 E.g., if fpi existed, I would add a shebang like this to my code:

 #!/usr/bin/env fpi


 InstantFPC http://wiki.freepascal.org/InstantFPC


 Cheers,


 Andrew Pennebaker
 www.yellosoft.us
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Any command line interpreters for Free Pascal?

2011-10-15 Thread Roland Schäfer
On 10/15/2011 9:10 AM, Roland Schäfer wrote:
 Good look,

I meant luck, of course.

 Roland
 
 On 10/15/2011 12:56 AM, Andrew Pennebaker wrote:
 Yeah, I know to chmod my scripts before dot-slashing them. It's just that
 fpc can't handle shebangs, and I don't want to have to choose either
 scripting or compiled. I like my Pascal code to be work in either mode.

 Cheers,

 Andrew Pennebaker
 www.yellosoft.us

 On Fri, Oct 14, 2011 at 6:49 PM, ik ido...@gmail.com wrote:

 On Sat, Oct 15, 2011 at 00:48, ik ido...@gmail.com wrote:

 On Sat, Oct 15, 2011 at 00:43, Andrew Pennebaker 
 andrew.penneba...@gmail.com wrote:

 Thanks ik. Merf, it appears fpc can't compile when a shebang is added. In
 future versions, can fpc treat shebangs as comments so that instantfpc 
 code
 could be compiled like normal Free Pascal code?

  $ cat hello.pas
 #!/usr/bin/env instantfpc
 program Hello;
 begin
 writeln('Hello World!')
 end.


 $ chmpd +x hello.pas


 Opps,
 $ chmod +x hello.pas


  $ ./hello.pas




 $ fpc hello.pas
 Free Pascal Compiler version 2.4.4 [2011/05/01] for i386
 Copyright (c) 1993-2010 by Florian Klaempfl
 Target OS: Darwin for i386
 Compiling hello.pas
 hello.pas(1,1) Error: Illegal char constant
 hello.pas(1,2) Fatal: Syntax error, BEGIN expected but const string
 found
 Fatal: Compilation aborted
 Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you
 did not specify a source file to be compiled)

 Cheers,

 Andrew Pennebaker
 www.yellosoft.us

 On Fri, Oct 14, 2011 at 6:29 PM, ik ido...@gmail.com wrote:


 On Sat, Oct 15, 2011 at 00:25, Andrew Pennebaker 
 andrew.penneba...@gmail.com wrote:

 E.g., if fpi existed, I would add a shebang like this to my code:

 #!/usr/bin/env fpi


 InstantFPC http://wiki.freepascal.org/InstantFPC


 Cheers,


 Andrew Pennebaker
 www.yellosoft.us



signature.asc
Description: OpenPGP digital signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC 2.4.2 source

2011-05-21 Thread Roland Schäfer
On 5/21/2011 1:19 PM, Rainer Stratmann wrote:
 They are typical dpkg messages. This is pretty normal when installing
 deb packages manually. That is not specific to Lazarus or FPC.
 The problem is that the tar contains *all* packages, but
 normally you don't want to install all of them. A README.txt would
 help. For example:
 If you want to install the gtk2 version of Lazarus use:
   dpkg -i foogtk.deb bar.deb etc.deb
 If you want to install the qt version of Lazarus use:
   dpkg -i fooqt.deb bar.deb etc.deb

 I downloaded from here:
 http://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20i386%20DEB/Lazarus%200.9.30/
 And I can not see such packages you mentioned.
 When type in for example:
 dpkg -i fooqt.deb bar.deb etc.deb
 there are still messages

Are you being serious about literally doing 'dgpk -i fooqt.deb'? Maybe
I'm not reading you correctly.

Anway, having just set up fpc and lazarus snapshots under Ubuntu 11.04
(and since we obviously all want everything always), this is how you
might succeed:

1. Unpack the Snapshot .deb.tar to whatever/
2. sudo dpkg -R -i whatever/
3. If there are complaints about missing dependencies, open Synaptics
afterwards, do Fix broken packages - Apply and, normally, you
should be fine.

I also noticed that the Lazarus i386-deb Link on the Snapshot page leads
to a package that gives you LCLBase not found (or similar) errors.

I used this package, which worked, and which also has a more recent date:

ftp://ftp.hu.freepascal.org/pub/lazarus/snapshots/lazarus-0.9.30.1.30409-20110510.i386.deb.tar

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


Re: [fpc-pascal] FPC 2.4.2 source

2011-05-21 Thread Roland Schäfer
On 5/21/2011 1:44 PM, Bernd Kreuss wrote:
 They are first making up a non-existing problem (people being forced
 to do something they allegedly don't want, although we all know the
 opposite is true and people *always* want a complete and painless
 install to avoid all sorts of problems) and then they are presenting the

I can refute your point about people always wanting complete installs by
simply referring to myself. How do you know what all users of FPC/Laz
always want?

 Just ignore what they [Debian] want. It is not relevant what they
 believe (or guess) what your users might want. Don't let them damage the
 usability and the reputation by listening to them and wasting time
 solving their fantasy problems while this is leading to the creation new
 and very real problems. The sheer existence of this thread (and other
 threads like this and many more) is testifying this.

Debian (and its derivates, to varying degrees) has one big advantage,
viz. its consistent and disciplined package management. I don't see how
giving a damn about their good practices and policies would help to
promote a comparatively small project.

 The Debian maintainers have no expertise in judging what the users of a
 given software really *want*, especially if they don't use it
 themselves. Simply ignore them. Their opinion does not matter. They will
 accept the big package. Don't bow to them, they want something from you,
 not the other way around!

I don't see the problem. FPC/Laz users get what they want on Debian etc.
It's just a matter of how you get it.

And once again, I want to stress that statements like Their opinion
does not matter. are not only not helpful, but I guess also wrong in
the sense that it does very much matter.

 The windows installer of Lazarus clearly shows how usability looks like.
 This is what users want! There is no reason why this should not be
 possible on Debian also. If Debian policies (or like in this case not
 even the written policies themselves but only the beliefs of some
 overzealous Debian maintainers) are the only thing preventing usability
 from coming true then to hell with them.

I'm not going to refute those universal statements again. The only thing
I can think of that would be a (rather insignificant) usability
improvement for Debian packages would be to have a repository for daily
FPC/Laz snapshots. Otherwise things have always been fine for me.

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


Re: [fpc-pascal] Re: stripping HTML

2011-04-18 Thread Roland Schäfer
On 4/17/2011 5:13 PM, Ralf Junker wrote:
 I am the author of DIHtmlParser.
 
 I do not know if DIHtmlParser compiles and works in FPC linux-x86-64
 because I do not have that environment available for testing.
 Unfortunately, low demand for that platform does not justify setting it
 up and supporting it on a regular basis.
 
 I can say, however, that the latest version source code is Pascal only
 and compiles on FPC Win32 without platform warnings. But I do suspect
 that it will need a few IFDEFs to make it Linux compatible. If so, I
 would of course be glad to add any to the code so they will be available
 in future versions.

I would volunteer to try and compile it under GNU/Linux 32 and 64 if
there is some interest in such work. I could not guarantee success nor
continued support, though. I'm not sure whether that's acceptable for a
commercial product. Feel free to contact me off-list, though.

 However, having read Stefan's more detailed, off-topic requirements
 description, I'd rather suggest that they come up with their own HTML
 parser and text filter. It sounds too specific to me to be handled by
 any standard component already available.

I was hoping to same time on the simple stripping, but I guess I will
continue my work on a custom parser.

Thanks for the input.

Roland

P.S. How do you know my boss' name is Stefan?



signature.asc
Description: OpenPGP digital signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: stripping HTML

2011-04-17 Thread Roland Schäfer
On 4/17/2011 11:00 AM, leledumbo wrote:
 http://www.festra.com/eng/snip12.htm
 Simple googling gives a lot of results, try: html strip (pascal OR delphi)

Thank you for your reply.

I feel I have to justify myself: I always do extensive web and list
archive searches before posting to a list (hence the infrequency of my
posts). I had actually found that snippet over a week ago but
immediately discarded it since it is obviously a toy solution. I have a
much better solution already using the PCRE library on a text stream,
sometimes re-reading portions of the stream by way of backtracking. The
problems with any approach like that (esp. 6-liners like the one linked
in your post, but also more elaborate buts still makeshift regular
expression magic) are:

1. They don't handle faulty HTML well enough.

2. They don't handle any multi-line constructs like comments or scripts.
Depending on how naively you read the input (e.g., using
TStringList.ReadFromFile), they even choke on simple tags with all sorts
of line breaks in between, which are frequently found (and which are, to
my knowledge, not even ill-formed). What do you do with this (for a start)?

'div class=al#13#10#13ert'

3. They are potentially not the most efficient solution, which is an
important factor if the stripping alone takes days.

As a clarification: I am mining several ~500GB results of Heritrix
crawls containig all versions of XML, HTML, inline CSS, inline Scripts,
etc. They need to be accurately stripped from HTML/XML (accurately means
without losing too much real text). The text/markup ratio has to be
calculated and stored on a per-line basis since I'm applying a machine
learning algorithm afterwards which uses those ratios as one factor to
separate coherent text from boilerplate (menus, navigation, copyright etc.).

I had anticipated a reply along the lines of read the documents into a
DOM object and extract the text from that. That is also problematic
since it is not fast enough given the size of the input (That is an
assumption; I haven't benchmarked the FPC DOM implementation yet.), and
I don't see how I can calculate the text/markup ratio per line in a
simple fashion when using a DOM implementation.

I am *not* trying to clean or format simple or limited HTML on a string
basis. For stuff like that, I wouldn't have asked. I actually wouldn't
use Pascal for such tasks but rather sed or a Perl script at max.

I would still highly appreciate further input.
Regards
Roland
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: stripping HTML

2011-04-17 Thread Roland Schäfer
Thanks a lot for your reply.

On 4/17/2011 3:46 PM, Ralf Junker wrote:
 HTML is not meant to be handled on a line-by-line basis as other
 text-based formats. According to the specs, HTML is not line-based.
 Browsers should display the following two HTML snippets identically:
 [...]
 As such, a line-based text/markup ratio does not make much sense IMHO,
 especially since browsers do strip line breaks in most text elements
 except within pre ... /pre.

This is sort of off-topic, so I'll make it short: Yes, that is a problem
we are aware of. However, experiments with even simple threshholds
(remove lines with less than 50% text) were sort of successful. Simple
machine learning makes it much better. To avoid true paragraph detection
(which would be desirable but costly given the TB-sized input) we are
also experimenting with several line-based and non-line-based windows on
the input and cumulative html/text ratios for those windows. Also, this
is only stage one of the cleanup, and we run some more linguistically
informed and costly steps on the already much smaller amounts of data.

Maybe I'll give paragraph detection based on p, div etc. another
try, but we actually decided against that a while ago because we lost
huge amounts of valuable input due to non-use or very creative use of
such elements in actual web pages.

 That said, I believe that DIHtmlParser should care for most of your needs:

Yes, that looks perfect. I wouldn't even have a problem with the license
or with paying for it, and I even still have D7. However, my program has
to run on our Debian 64-bit servers.

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


[fpc-pascal] stripping HTML

2011-04-16 Thread Roland Schäfer
Hello everyone,
is there any existing FPC code (even external libraries with bindings)
to strip HTML tags from files, including adequate removal of scripts,
comments and other multi-line non-text - and which handles faulty HTML
input in a tolerant fashion? I also need to keep track of how many
characters per line were removed. Thanks in advance.
Regards - Roland
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] macros

2011-03-16 Thread Roland Schäfer
Hi,

INCLUDEs like these will insert the appropriate strings into your code:

{$INCLUDE %DATE%}
{$INCLUDE %TIME%}
{$INCLUDE %FPCTARGETCPU%}
{$INCLUDE %FPCTARGETOS%}
{$INCLUDE %FPCVERSION%}

There are more... AFAIK it's documented in the Programmer's Manual.

Cheers
Roland

On 3/16/2011 2:18 PM, Marcos Douglas wrote:
 Hi,
 Some day I saw an example using macros on the code.
 I want to put the compiler version in an about form... I remember
 something like %fpcversion%... %date%...whatever.
 
 Marcos Douglas
 ___
 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