User:Bart

From Free Pascal wiki
Jump to navigationJump to search

Who Am I

Full name: Bart Broersma
Country of origin: The Netherlands.
What I do in real life: I am a health care professional working in a nursing home where I specialize in geriatric rehabilitation.

My homepage: https://www.flyingsheep.nl (it is in Dutch).
It has a general software section (Delphi and Lazarus) and FreePascal and Lazarus units.
My Subversion repository is at: https://svn.code.sf.net/p/flyingsheep/code/trunk/

Me and programming

In 1983, while I was a first year med student, I followed a summer course in programming in MUMPS (on a mini-computer). This was my first experience in programming.
It was not until 1991 that I had another encounter with a (Personal) Computer. This time at my very first job.
Soon I began reading books on DOS and WordPerfect 5.1, and I started writing WordPerfect macro's (in a really horrible language, see "LEARNING THE MACRO PROGRAMMING LANGUAGE").
I saved up some money and bought a 286.
Then a friend gave me a copy of Turbo Pascal 3.0 and an introduction book on structural programming using Pascal.
As time past by I upgraded to TP 5.5, TP 6.0, Delphi 1 and Delphi 3.0.
Some of my early TP programs evolved along the way.
After Delphi 3 the new Delphi's became either to heavy for my machine (which dates from the year 2000), or they were just way too expensive for, what is only my hobby.

Then one day I learned about Lazarus in a Dutch magazine on Pascal programming (appropriately called Blaise) and I took a quick look. Lazarus then was appr. at version 0.9.10, and it was not very stable yet, so I left it for a while.
But I had also grown an interest in Linux, and of course wanted to program in Pascal there as well. So I came back again after some time, to find that progress was made steadily on, and from appr. 0.9.12 I jumped on board, this time to stay.
In 2007 I submitted my first patch for the Lazarus project.

Since 0.9.26 Lazarus IMO outperforms Delphi 3.0 regarding available components (some of them unavailable in D3) and the IDE (in particular the codetools).
I now hardly ever use Delphi anymore, most of the time only to compare Delphi VCL/RTL behaviour against Lazarus/FreePascal.
I have grown so used to Lazarus that the Delphi 3 IDE now feels very sluggish and cumbersome to use. (OTOH, the Borland compiler/linker is still much faster, and integrated debugging is easier.)

Working with Lazarus, I have of course encountered bugs in both FreePascal and Lazarus. Many of these were in rather "basic" components, that make up most of my programs (it seems to me that many Pascal users do database applications and web-related stuff, and use lots of fancy controls, where most of my apps are just very basic).
And since not very many people seemed bothered by the bugs I encountered, I tried fixing them myself (with the help and support of many of the Lazarus community). The spirit of this Open Source project has caught me, and I find trying to contributing to it a very pleasant spending of my spare time.

My current goal for Lazarus :-)

To keep Fpc and Lazarus Windows98/WinME compatible.

The end of support for Win9x has come.
Ironically I'm now actually removing specific Win9x code form our codebase.
The 1.6 series (with fpc 2.6.4 as compiler) will be the last series that supports this platform.
Nostalgic feelings set in ...

Lazarus interests

Maintaining the MaskEdit unit.
Utf8 related file functions on Windows
General LCL
Win32 widgetset

ToDo List

  • Sanitize the LazFileUtils and FileUtil units. They share several functions, some with different implementations, which is a maintanance nightmare.
  • Fix bugs related to implicit codepage conversions with the codepage aware strings (fpc 3.0 and up)

Things I would like to have in Lazarus/FreePascal

  • A native ObjectPascal debugger We have FpDebug now!

Notes for myself

git/gitlab

Crosslinking on GitLab example:
/relate freepascal.org/fpc/source#39295
See: crosslinking issues

Find issues I reported in Mantis in the Gitlab conversion:
"<small>Bart"

Find issues I monitored in Mantis:
"» @flyingsheep"


svn

To prevent unwanted update/commits, do a

svn -q status

before committing something.

Also, when only some subdir changed, commit the subdir only:

svn commit --message "foo" path/to/changes



Correct a wrong log-message:

svn propedit -r N --revprop svn:log URL     #this line may be superfluous?
svn propset -r N --revprop svn:log "new log message" URL
; or
svn propset -r N --revprop svn:log --file messagefilename URL


where N is the revision number whose log message you wish to change, and URL is the location of the repository. If you run this command from within a working copy, you can leave off the URL (Source)

To reverse a patch do

svn patch --reverse-diff patchfile


gdb


Q: How do I run a program with commandline args using gdb

A: You can run gdb with --args parameter,

gdb --args executablename arg1 arg2 arg3

Lazarus and fpc


Q: What do I need to do to get a property on the Restricted tab in OI and in the Restriction Browser?
A: Edit the appropiate issues.xml, for each affected widgetset

FPC_FULLVERSION construction:
Major*10000 + Minor*100 + Revision

patch.exe on Windows

  • Files need to have CrLf line endings
  • You need to use the -p0 parameter or else it fails when filenames contain paths (assuming folder layout fits)

So e.g to test the patch, in ($LazarusDir):

C:\devel\lazarus>patch -l --dry-run -p0 < patchfile.diff


Add a new icon to the component pallette.

  • Add the icon (.png) with the name of the component type (like tbuttonedit.png) to ($lazarusdir)/images/components
  • Add the filename of the new icon, preceded by components/, (e.g. components/tbuttonedit.png) to ($lazarusdir)/images/components_images_list.txt
  • from with ($lazarusdir)/images run the components_images.bat, this will rebuild the components_images.res file
  • do a clean build of Lazarus



Prevent adding of units in uses clause of main .lpr:
Project Options / Miscellaneous / Main unit has uses section containig all units of project (uncheck that)

Linux



Show installed packages on Debian:
--get-selections will show you the installed packages

dpkg --get-selections | grep gtk

or:

dpkg -l libgtk2.0-0 libgtk-3-0

On Mint 18.2 you need:
libgtk2.0-dev, libgdkpixbuf-2.0.dev, libc-6.0-dev, libpango-1.0-dev, libatk-1.0-dev



On Linux you can get a linker warning like this:

Linking project1
project1.lpr(21,1) Warning: "crtbegin.o" not found, this will probably
cause a linking failure
project1.lpr(21,1) Warning: "crtend.o" not found, this will probably
cause a linking failure

Most likely, linking will not fail.
Here's how to find where that file is (you need to have gcc installed), and tell the fpc (which tells the linker):

bart@simenon ~ $ gcc --print-file-name crtbeginS.o
/usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o

Add the path into fpc.cfg:

# path to the gcclib
#ifdef cpui386
#-Fl/usr/lib/gcc/x86_64-linux-gnu/5  if you have a 32-bit fpc: fill in the path here
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/5
#endif

Add new dialog to widgetset

(The dialog must inherit from ultimately TLCLComponent)

In lcl/widgestet/WSDialogs
- add class TWSTheNewDialog
- if not already done add the class factory: TTheNewDialogClass is class of TTheNewDialog)
- add procedure RegisterTheNewDialog

In lcl/widgetset/WSFactory
- add function WSRegisterTheNewDialog : Boolean; external name 'WSRegisterTheNewDialog';

In lcl/interfaces/XXX/XXXFactory
- add function RegisterTheNewDialog: Boolean; (in interface)
- implement as function RegisterTheNewDialog: Boolean; alias : 'WSRegisterRegisterTheNewDialog';
- in the NoGUI WS simply let the function return False
- in WS that support this do it like:

begin
  RegisterWSComponent(TTheNewDialog, TxxxWSTheNewDialog);
  Result := True;
end;

If a certain widgetset does not override any method of the base WS implementation, then for that WS you should register the base class:
(Make sure to add the WSDialog unit to the uses clause)

begin
  RegisterWSComponent(TTheNewDialog, TWSTheNewDialog);
  Result := True;
end;

In lcl/interfaces/XXX/xxxWSDialogs
- add class TxxxWSDialogs = class(TWSDialogs) and override class methods.

In LCL code of the dialog of the dialog add:
class procedure WSRegisterClass; override;
implement as:

begin
  inherited WSRegisterClass;
  RegisterTheNewDialog;
end;


Misc

Suppress forum tags in the lazarus forum:

[nobbc][code][/code][/nobbc]

This will show as:

[code][/code]

in the forum.

Useful wiki links (for myself, to refer people in the bugtracker amongst others)

Usefull external links