A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

CompactUtils and CompactSysutils


Download

SVN: We recently moved to Google Code

Old SVN server: /psp-1.6.x-devel/extras/compact-utils/


If FPC team wants to include CompactSysutils as part of the FCL or the RTL we welcome to work with them on that. Please contact us if you think it can be included.

The files have been modularized into several units now. CompactSysutils is just a wrapper around them. This was done so that SysUtils is no longer huge, monstorous, bloated and welded together with a bunch of ugly FPC include files. The giant must be modularized, unlike the sysutils seen in the FPC sources which is a nightmare.

http://code.google.com/p/powtils/source/browse/dev/main/pwfileutil.pas http://code.google.com/p/powtils/source/browse/dev/main/pwstrutil.pas http://code.google.com/p/powtils/source/browse/dev/main/compactsysutils.pas http://code.google.com/p/powtils/source/browse/dev/main/compactutils.pas


The name "compact sys utils" came about because it creates compact binary programs, not because this is a small project. It is in fact a large plethora of utilities.
These units are also included in the extras folder of Powerful Web Utilities packages
These units are for compact programming.. they are designed to produce small executables (maybe useful for CGI/Embedded/Other niches). They can also be used in everyday programs though.

Thank you to Bernd M. for supplying patches for Arm.. I don't have an Arm processor yet, and thought these units would really be useful for Arm processors.

If anyone has patches or suggestions feel free to contact L(@)z505(dot)com I am willing to give SVN accounts or accept simple patches. Or you can talk about it on the Powtils Mailing Lists.

Included in these units are a compact stringlist, several common sysutils functions, and several common string functions. All are smartlinked into your application without using hefty initialization/finalization code.

Catch 22 - some exceptions are commented out

The StrToInt function for example doesn't use exceptions in compactSysUtils unit.. but in the real sysutils unit it does use exceptions (and some other functions do not use exceptions of course). So it is wise to do checks before converting strings to integers. For example you can use the IsNum function, IsInteger, etc from the StrFilter.pas unit also included with powerful web utilties.

Personally, I find using IsNum() is nice many times anyway.. as all I want to do usually is verify the person has input a number like 0-9, etc. That is usually cleaner than handling some exception since you pretty much have to check whether your input is correct or not.. and this is an Expected situation, hence not really an exceeption! Also consider the Val() and Str() functions which are alternative to StrToInt and IntToStr anyway.

Also see IsInteger() trick..

Catch 23 - DateTime functions not ready

I haven't tried to get DateTime functions into this unit yet.. and maybe some time I can figure out (or you can help figure out with me) how to add datetime and more functions to this unit, while keeping it smartlink capable at the same time.
See also Compact Sysutils notes

About
This site is about programming and other things.
_ _ _