Graeme Geldenhuys wrote:
> I'm trying to detect where bottlenecks occur in my code.
On Linux, you can get some interesting information with something like this:
% valgrind --tool=callgrind [YOUR_APP] [YOUR_ARGS]
% callgrind_annotate --auto=yes --inclusive=yes > callgrind.log
And then have a l
David Baldwin's components are very nice, but maybe
not so portable. I think they used to be closed-source,
but the only license info I could find on his website
now says:
"Complete source code is provided. The HTML Display
Components may now be used without charge in any
application including t
> the easiest is simply making a FPC header to
> pcre, it might be useful even.
I did that, once upon a time...
http://www.hotlinkfiles.com/files/526004_qpvr0/pcre-fpc.tar.gz
-Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://
> > this kludge is about 25% faster than your perl script
> > on my machine
> Nope. It's still more or less twice slower. :-D
I guess it depends on the hardware:
% time koleksi.pl # perl
Word count: 126944
Unique word count: 11793
real0m1.019s
user0m0.992s
sys 0m0.028s
% ti
Heck, I'm not even a programmer, and this kludge is
about 25% faster than your perl script on my machine
program koleski;
{$MODE OBJFPC} {$H+}
uses classes, strings;
var
f: text;
s:ansistring;
wc:longint=0;
wl, ul:TStringList;
i,n:LongInt;
begin
assign(f, 'Koleksi.dat');
reset
Here is something you might like:
http://setedit.sourceforge.net/
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Does somebody have something in source that they'd share
with this poor guy, please?
Maybe you can find something here?
http://torry.net/pages.php?id=256
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/
It looks like the mailing list archives (and daily digest) don't like
some messages:
http://lists.freepascal.org/lists/fpc-pascal/2007-January/013070.html
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/ma
On Sat, 30 Dec 2006, Krishna wrote:
btw, is there a (free)pascal translation of the cairo headers?
I started one some time back, then lost interest -
Here's what I have, X only, no Win32...
- Jeff
cairo.pp
Description: Binary data
___
fpc-pascal mai
I remember seeing some sort of system ( I can't remember
the name or URL ) that used a pascal compiler to pre-compile
CGI applications. Whenever a client request involved one the
apps, the server would check the timestamp of the source
against the timestamp of the binary. If the the binary was
new
{$H+}{$MODE OBJFPC}
Results in short strings with fpc-2.0.4, and
long strings with previous compilers.
Is this a bug fix, or a new bug?
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fp
Better, but still Linux only. For a good solution,
a resolver unit that accesses libc should be
written that is portable (unlike the libc unit)
If I understood correctly, the OP had two questions:
1. Retrieve a list of interface names on a *linux* system.
2. Return the IP address for a given *
how can i list wich interface loaded without
need to parse /etc/networks/...?
I would parse /proc/net/dev instead
program ifnames;
var
s:shortstring;
f:text;
p:LongInt;
begin
assign(f,'/proc/net/dev');
reset(f);
while not eof(f) do begin
readln(f,s);
p:=pos(':',s);
if ( p
Errm, I actually forgot the obvious questions:
What's wrong here? How can I get around it?
cat input.h | awk '{gsub(/\<__int64\>/," long long "); print}' > output.h
- should work, at least on Linux x86
- Jeff
___
fpc-pascal maillist - fpc-pasca
> function to read the local IP eth0/eth1 using glibc library.
program ip_addr;
...
end.
Please ignore my last post -
This one is a little cleaner...
program ip_addr;
{$MODE OBJFPC}
uses libc;
function GetIPAddressOfInterface( if_name:ansistring):ansistring;
var
ifr : ifreq;
sock : lo
I'm trying to write a function to read the local IP eth0/eth1
using glibc library...
program ip_addr;
{$MODE OBJFPC}
uses libc;
const
IP_NAMESIZE = 16;
type
ipstr = array[0..IP_NAMESIZE-1] of char;
function GetIPAddressOfInterface( if_name:ansistring):ansistring;
var
ifr : ifreq;
tmp:ips
Maybe you can create the array dynamically at run-time,
in the unit's initialization section...
type
p_handler_rec=^handler_rec;
pp_handler_rec=^p_handler_rec;
var
hw_handlers:pp_handler_rec;
initialization
hw_handlers:=getmem(sizeof(p_handler_rec)*2);
new(hw_handlers[0]);
hw_handlers[0]^
Why not wxWidgets?
I'm not too familiar with wxWidgets, but
the headers sure look like C++ to me.
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
If I remember correctly, the DOS FindFirst/Next only handles
shortstring-sized path names.
Another "quirk" about using FindNext on Unix is that a
symlink to a directory sets the faDirectory flag, and if it
happens to be a circular symlink, I don't know of any
way tell if it is safe to recurse in
Yes, much better!
I had not even looked at it till now.
One suggestion: I think the sentence about the M680 should
be moved to the end of the first paragraph. Finish telling
me about what you do support first. I'm only on the second
sentence of the entire website, and already they're telling
me w
I am trying to convert nano-X.h to a pas file but I get some errors.
This is 2 of them.
I cannot se what the problem is, can anyone give me a hint.
h2pas is not perfect, some things it doesn't understand,
and other "C" things simply don't make sense in Pascal.
So you will probably end up trans
My totally un-scientific test says that for the current
"fpc-2.0.2.i386-linux.tar" archive, using bzip2 instead
of gzip, it would take about one minute longer to create
the archive, and shave about 4 MB off the size.
That would cut about 15 minutes off the download time
for most 56k dial-up users
Anybody know of a function that can remove (normalize) a string
by remove all beginning and ending whitespace
uses SysUtils;
S:=Trim(S);
as well as replace all repeated spaces with a single space.
uses StrUtils;
S:=DelSpace1(S);
A bonus would be to remove tabs and newlines chars as well
Because gzip is spread wider, we use this instead of bzip2/7zip.
I think the size saved by compressing FPC with bz2 would be much
greater than the size of downloading and installing a bzip2 extractor.
- Jeff
___
fpc-pascal maillist - fpc-pascal@lis
> is there a way to skip the HTML head and footer so the page
> is not a complete html document but just a snippet of html?
> ...
> For example, skipping the html body, head, head closing,
> and body closing tags at minimum.
tidy --show-body-only yes test.html > test-body.html
http://tidy.source
> What command would be used to run FPCdoc on all files in a directory.
> PSEUDO EXAMPLE: (crashes fpdoc)
> fpdoc --package=Test --input=*.pas;*.inc;
fpdoc --package=Test $(ls -1 *.pas *.inc | awk '{printf("input=%s ", $1)}')
- Jeff
___
fpc-pascal mai
> I'm interest on an OS independed (or at least Linux and MacOS),
> Windows ATOM like* feature, supported by FreePascal.
Maybe this?
http://www.xfree86.org/4.0.1/XInternAtom.3.html
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.
> ... when I do this, I get an AV (in Delphi7).
>tidyOptSetValue(fTidyDoc, TidyErrFile, ctmbstr(TIDY_NULL_FILE));
>tidySetErrorFile(fTidyDoc, ctmbstr(TIDY_NULL_FILE));
> { where TIDY_NULL_FILE = 'NUL' for Windows }
If you can send me (off-list) a short sample program that
shows the AV,
> > How about LUA ?
> Yes! It seems like i was looking for, thank you very much :-)
Glad to help!
There is also an IDE for LUA, written in Delphi:
http://luaedit.luaforge.net/
It is probably overkill for what you need, but it might
be useful to get some ideas on pascal+lua integration.
- Je
> I want to embed an interpreter in my Free fpc game...
How about LUA ?
http://www.lua.org/about.html
FreePascal bindings:
http://assoc.wanadoo.fr/thallium-software/thlua.en.html
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http:
> Prefixing an 'A' seems to be an (un)official delphi naming convention
Does this make it official?
http://www.econos.de/delphi/cs.html#ObjectPascal_Procedures_Parameters
" The 'A' prefix is a convention to disambiguate when the parameter name
is the same as a property or field name in the cla
> 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
> Here's the complete XML file I was trying to read...
> ...
Not sure if this is part of the problem,
but this line:
2005.01.20 12:26:58
Note the spelling:
!=
- Jeff
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepa
> the new for..in loops in Delphi caught my eye
> fpc 2.0.0 doesn't compile this... are "for..in" loops
> in a newer version or will they be sometime soon?
I believe this was discussed at great length back in February,
but I'm not sure what the final verdict was:
http://lists.freepascal.o
> I would like to download a file via HTTP, how can I achieve that in a
> platform independent way? What components to use and is there
> some code suited for dummy's available.
If you don't mind using an external DLL, CurlPas is quite simple,
and works on Linux, Windows, and possibly even Mac..
> With freepascal 1.0.x I was able to compile cURL-Pascal-Bindings
> (http://curl.haxx.se/libcurl/pascal/). This is not longer possible
> with freepascal 2.0. Anybody know how to do this?
> Anybody knows a replacement?
Your timing is perfect, the new version of CurlPas is just released today!
Ple
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
.
___
fp
> All of the Pascals that I have used allowed the
> following shorthand, an extension:
> reset(aFile, FileNameString); {or rewrite, etc.}
> I tried overloading reset() ... but it didn't work.
procedure reset(var f:text; const fn:string);
begin
assign(f, fn);
system.reset(f);
end;
procedure r
> > Error: Identifier not found "opendir"
> See baseunix.fpreaddir etc in the help.
> Note that it is nearly always better to use the highlevel
> Pascal equivalents findfirst/findnext.
Just be careful calling FindNext recursively on Linux, things can
go haywire if you hit a symlink to '.' or s
> In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> But in Pascal non have the setenv() procedure as in C :(
> ...
> Actualy I resolve this problem with sending the output to a file, and
> then reading the file.
It sounds to me like you just want a global
variable, not an environment va
> > {===}
> > program contest;
> > uses windows;
> >
> > var
> > info:tSTARTUPINFO;
> >
> > begin
> > GetStartupInfo(@info);
> > if ( info.hStdInput = 0 )
> > then {Started from Explorer}
> > else {Started from Console}
> > end.
> > {===}
>
> > > Is it possible for a program to tell whether it was started
> > > from the command line or started by double-clicking on the
> > > application icon?
> > {=}
> > program envtest;
> > uses Dos;
> > var
> > F:text;
> > i:LongInt;
> > begin
> > assign(F, 'envlist.txt
> Is it possible for a program to tell whether it was started
> from the command line or started by double-clicking on
> the application icon?
Under Win98, there are some subtle differences in the output of the program
below, when run from a DOS window vs. double-clicking the icon.
I don't kno
> Since it's not online at Borlands website any more (from somewhen in 1998)
Is this it ?
http://info.borland.com/borlandcpp/papers/bc360/
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> how can I test - at runtime - under which OS (Linux, Windows and so on)
> a FPC-program is running?
{$IFDEF unix}
http://www.freepascal.org/docs-html/rtl/baseunix/fpuname.html
{$ELSE}
{IFDEF WIN32}
http://msdn.microsoft.com/library/en-us/sysinfo/base/getversionex.asp
{$EN
> > OK, I didn't try that, so it is allowed to define a type
> > as a pointer to a type that is defined later.
> Yes, but _only_ if the type declaration comes _immediately_ after
> the pointer type declaration. So you can't just declare a bunch
> of pointer types and defer the actual type-declara
> Last question to Jeff Pohlmeyer : could you explain
> how you made that unit ?
Hello, Koenraad...
There is not really a one-size-fits-all solution to this,
but in general this is what I did for this particular case:
# be sure to clean up any leftovers first:
rm -f all.h all
> If you want to take a look, I've put it on
> http://users.edpnet.be/~koenraad/www
Okay, try this...
In your ulinuxgnu300 directory, type:
make clean
make linux
ar -r libonewire.a *.o
ranlib libonewire.a
And then move the resulting "libonewire.a" file into
a directory where the link
I still don't understand what sort of c "package" you have
that generates a bunch of object files, but doesn't create
a shared library or static archive.
Does it have its own makefile or configure script?
Sometimes adding --enable-shared or --enable-static
to configure will tell it to build a li
> My question : is the linker not smart enough to find out
> by itself where to look for those missing object files ?
Not sure if I understand your question, but as Marc already
mentioned, you can control this with the -k-L compiler switch.
You can also control the way the compiler/linker sear
> Let me explain more : the header file is used in at least
> five source-files, so compiling gives (at least) five .o
> files, but none with the name of the header-file.
>From the command line :
ar -r libDallas.a file1.o file2.o ...
and then, in your program:
{$LINKLIB Dallas}
- Jef
> unit b;
> ...
> {$undef M1-M15}
> {$define M2}
> ...
> end.
Can't you just put all your $undef's in a *.inc file,
and then $include it anywhere you need to undef all?
unit b;
...
{$include undefs.inc}
{$define M2}
...
end.
--
_
> > I'm looking for a good free (as in speech) parser generator for
> > FreePascal. Right now I'm working with Coco/R (from
> > http://www.tetzel.com/CocoR/) and I'm not very pleased with this tool.
> > The generated code works perfect with fpc-1.9.4 but the (parser)
> > compiler only works on Wind
> are there units available to achieve GTKExtra from Free Pascal?
There is now...
http://www.geocities.com/yetanothergeek/gtkextra.pp.gz
.
__
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.co
> 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
Here is another link you might find useful:
http://www-rab.larc.nasa.gov/nmp/fNMPhome.htm
__
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
__
> > After allocating a new instance for Arec with New proc,
> > the record fields (APointer and Aint) will be always
> > zero filled or will receive random values?
> You must do as if it contains the most unexpected data,
> and therefore initialise the fields *yourself*, and the
> safer is to d
> My question: how can I force a redraw on selected
> widgets or the whole window when needed?
Maybe this will help:
procedure UpdateWidget(w:pGtkWidget);
var
update_rect: tGdkRectangle;
begin
update_rect.x:=0;
update_rect.y:=0;
update_rect.width:=w^.allocation.width;
u
> I tried to use gtk_window_remove_accel_group(...) but it is not
> found by fpc (gtk has it, I've got the name from its docs).
> Is is possible in a simple way to get the missing procedure working?
Just add this declaration somewhere in your program:
procedure gtk_window_remove_accel_group(win
> Has anyone translated the XTest xtension of XFree86 to pascal yet?
I think it would look something like this:
unit XTest;
interface
uses x, xlib;
const
X_XTestGetVersion = 0;
X_XTestCompareCursor = 1;
X_XTestFakeInput = 2;
X_XTestGrabControl = 3;
XTestNumberEvents = 0;
XTestNumbe
> Dunno if this is the right place to post such a message, but here goes...
> I would love to see a "pos" function that takes an additional parameter, being
> the position in the string where it should START scanning. e.g.:
> my_str = 'Hello, everybody... Hello, world!';
> x := pos ('Hello', m
program testbot;
uses dos;
function exists(const fn:string):boolean;
var
f : text;
begin
{$I-}
if ( fn <> '' ) then
begin
exists:=True;
ioresult;
assign(f, fn);
reset(f);
if ( ioresult = 0 ) then close(f) else exists:=False;
end else exists:=False;
{$I+}
end;
fun
> > Inconsistency detected by ld.so: dl-minimal.c: 134:
> > realloc: Assertion `ptr == alloc_last_block' failed!)
> The error you get is because you probably forgot to put 'cmem'
> as the first unit in your program's uses clause.
I'm not sure about SQLite, but i have seen this problem
using so
> Well there is always libCurl. I've looked this over
> and it looks quite thourough check it out.
LibCurl doesn't expose it's DNS functions directly.
Earlier versions use basically the same system calls as your pascal
program would. However, the more recent versions of libcurl have a
compil
Since Free Pascal supports function overloading,
you could do something like this:
Function CheckPoint(X, Y:real): Boolean;
Begin
{Does something here..}
end;
Function CheckPoint(aPoint: tMyRec): Boolean;
Begin
Result:=CheckPoint(aPoint.X, aPoint.Y);
end;
// So you can use it either way:
> It's possible to implement Libglade in fpc? Anyone has do it?
1.0:
http://site.voila.fr/yvesd/downloads.htm
2.0:
http://sourceforge.net/projects/gtk2forpascal
__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/fi
There is a cookies unit listed under " Contributed Units -> Internet "
on the freepascal website, but unfortunately, the link seems be broken.
( Or at least down right now. )
I had a copy laying around, so I uploaded it to my personal homepage:
http://houston.quik.com/jkp/cookies.zip
Please
The libc unit declares the sigaction() function in "sigactionh.inc" as:
function sigaction( __sig:longint; Const act: _sigaction;
Var oldact: _sigaction):longint;cdecl;external clib name
'sigaction';
According to the libc man page: "Either act or oldact can be a null pointe
There is a large amount of Delphi-related graphics stuff
on Earl F. Glynn's website, but I don't know if there is
anything that can be used with with Free Pascal:
http://efg2.com/Lab/Library/Delphi/Graphics/ImageProcessing.htm
http://efg2.com/Lab/Library/ImageProcessing/index.html
http://ef
Maybe a little off-topic, but here is a small example to do
multiple lookups asynchronously using the "ARES" library:
http://houston.quik.com/jkp/ares_pas.pp
__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.y
> Can someone give me a simple example of a makefile suitable for
> just simple compiling of one file ? I am so used to running FPC
> from the command line that make is foreign to me.
[EXAMPLE]
#!/bin/bash
all:
ppc386 somefile.pas
debug:
ppc386 -vewh -gl -Crtoi somefile.pp
There is a subtle difference between ParamStr(0) and argv[0]:
argv[0] is the verbatim command passed to the shell.
ParamStr(0) is the full path to the executable.
Neither of these will dereference a symlink, to do that you
can call ReadLink recursively, or ReadLink(/proc//exe)
Also note tha
> > That's so pathetic. What'd the hacker do anyhow ? And how the heck does
> > > a hacker break into a *nix box ? (I assume it is...)
> > It's easy. At least if you run an old redhat, or run some of the dangerous
> > services.
> You really need to be deligent and keep up with the security updat
> With compile modes: -gg -gl
> Aren't line info and tracebacks suppose to be shown,
> the above example does not show these.
I think the problem comes with using exceptions. Normally, if a
run-time error occurs, the default exit proc will print the line
number info to stdout. But if an exceptio
There seems to be some minor conflicts between
the linux unit and the new libc unit on 1.0.10
They both seem to get the job done, but putting them
both in the same uses clause could make me crazy. :-o
Any suggestions/opinions as to which one is best?
__
Do you Y
I use NEdit for nearly all my editing.
On the surface, it looks and acts almost like windows notepad.
But under the hood, it has lots of powerful features, most of
them specific to programming. Things like syntax highlighting,
macro recorder and interpretor, shell commands, text filtering
from
> I have also written a program that will make nedit
> act something like an "IDE" for free pascal:
> http://houston.quik.com/jkp/ne4fpc/
Just my luck, I have hammered on this this thing for almost a year now,
and thought I had gotten all of the "show-stopper" bugs out of it.
Yesterday I foun
> But as I was bored to reboot my linux, just to compile a program...
I feel your pain :-o
Another option, maybe to think about:
I have had *some* success running ppc386.exe under WINE,
although it doesn't seem to find all of its units properly.
So I had to put all of the binaries and units re
> like you could arrange for NULL results to be returned as the string
> value 'NULL' but then you would be unable to distinguish between
> actual strings with the value 'NULL' and the NULL result...
Just a thought, but maybe you could return
the single-character string: #0
__
> The FPC team is pleased to announce that version 1.0.10 of
> the Free Pascal Compiler is (finally) released.
Hooray !
Great work, guys.
I also downloaded the latest version of the HTML documentation
( I absolutely despise PDF ).
The documentation looks good, but I found some broken links
(*
How about using "set of char" instead of "array of char" ?
That way, the compiler should be able to distinguish
between the overloads...
*)
program repl;
type
tSetOfChar = set of char;
procedure replace(chars: tSetOfChar; const replace: String; var s: String);
var
i: Integer;
begin
> 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 fro
> However I'm quite sure that it has to with the
> OO-methods for accessing array-elements
Having no idea what this object is doing, I might be
way out of line here, but maybe it would speed things
up to implement some sort of a "ForEach" callback,
rather than indexing the array on each call.
> I'm launching another program from Freepascal program through "exec"
> I need code that can set the position and size of the started program.
I haven't used Windows in a while, but I think you need
CreateProcess() instead of WinExec()
You can to set the dwX, dwY, dwXSize, and dwYSize fields
o
If you have a copy of Delphi's ImageHlp unit,
( or h2pas + imagehlp.h winapi header )
you might want to take a look at this:
http://www.blueorbsoft.com/CodeTips/DelphiCodeTips2.html#ListDLLFunctions
__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. A
85 matches
Mail list logo