A r t i c l e s
StuffString for KOL
You can cut and paste Move() and StuffString() functions out of FreePascal source code (sysutils and strutils) and paste them into your unit.
Here is the download link for an example unit showing stuffstring in use:
When calling on this function without cutting and pasting it into your unit, it will bring in 50K and it will conflict with freepascal's windows.pas (since sysutils relies on windows.pas out of freepascsal, and KOL relies on windows.pas out of ppDelphi.zip or Thaddy's package).
If you cut and paste it directly into your unit, it will only cause about 3K to the exe.
The initialization/finalization must cause the 50K in the exe, or other things.. so use StuffString directly by cutting and pasting it into a unit of your own.
Further optimizations with StuffString for KOL may be to use one of FASTCODE's "move" functions. It can be downloaded and seen here: FastCode Move Challenge You'll probably want one of the Pascal versions of fastcode if freepascal doesn't compile the assembly versions easily.
Paste this into your code to have access to a stuffstring function when using in KOL.
Call it Move2 and stuffstring2 just to avoid conflicts with move from kol.pas
(rename to move2, or myMove to aviod conflict if you wish)
procedure Move(const source;var dest;count:SizeInt);
bytearray = array [0..high(sizeint)-1] of byte;
if count <= 0 then exit;
if @source<@dest then
for i:=count downto 0 do
for i:=0 to count do
(rename to StuffStr, or StuffString2 to avoid conflict if you wish)
Function StuffString(const AText: string;
AStart, ALength: Cardinal;
const ASubText: string): string;
i,j : longint;
SetLength(Result, i - ALength + j);
move2 (AText,result,AStart - 1);
move2 (ASubText,result[AStart], j);
move2 (AText[AStart+ALength], Result[AStart+j],i -AStart - ALength + 1);
Note: This Wiki is outdated, personal views may have changed.
This wiki contains info on life, health, humans, nature, programming, database, fads, paradigms, poems, principles, theories.
Articles may contain statements which some may find helpful and encouraging, or even discouraging.
Beware, I believe in the Grand Justice system.