Archive for the ‘Delphi’ Category
Posted by jpluimers on 2016/10/12
Check out $(BDS)\source\cpprtl\Source\misc\unmangle.c – it contains the source code for the unmangling mechanism used by TDUMP, the debugger and the linker. (C++Builder and Delphi use the same mangling scheme.)
…
This has been around as long as BCC itself. However the file was called um.c instead of unmangle.c in older versions
Source: [WayBack] Delphi – unmangle names in BPL’s – Stack Overflow both by User Moritz Beutel.
It’s the same mangling used in the TD32/TDS and MAP symbols.
And neede to improve https://github.com/jpluimers/map2dbg (which is my fork of https://github.com/andremussche/map2dbg) which contrary to it’s name also supports TDS/TD32 conversions in tds2pdb. The code is C# and works in virtually any Visual Studio version of 2012 and younger.
–jeroen
Posted in Debugging, Delphi, Development, MAP Symbol Information, Software Development, TD32/TDS Symbol information | Leave a Comment »
Posted by jpluimers on 2016/10/06
Allen Bauer (ex Delphi R&D team) wrote the brilliant piece about a year and a half ago. We can still dream, right?
Allen Bauer, May 25, 2015
Current working theory of Nullable<T>.
Nullable<T> = record
…
property Value: T read FValue; default;
…
end;
Using the default directive to “hoist” the operators of “T“. Currently the default directive only works for array properties by “hoisting” the ‘[]‘ operator. Marking a non-array property with default will make the containing type behave as that type.
This, coupled with some intrinsic compiler knowledge of the Nullable<T> type will make Nullable<T> work without any addition of keywords or other standard functions or procedures.
Using the “default” directive on a non-array property will work for any type, except for having the null-propagation semantics.
When considering language features, I try and not only make it work for the intended purpose, but also broaden reach of any supporting feature. In the above scenario, even user-defined operators on “T” will be properly hoisted and used.
This was part of a very interesting G+discussion at Delphi’s New Feature Desired: Nullable Types and Null Propagation….
It covered topics like these:
–jeroen
Posted in Delphi, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/10/05
Oh nice System.SysUtils.TCardinalHelper.Parse:
class function TCardinalHelper.Parse(const S: string): Cardinal;
begin
Result := StrToInt(S);
end;
Which means you get this nice EConvertError with message ''4294967295' is not a valid integer value'. with this simple test (which doesn’t even reach the Assert):
uses
System.SysUtils;
procedure Cardinal_Parse_High_Cardinal_Succeeds();
var
Expected: Cardinal;
Value: string;
Actual: Cardinal;
begin
Expected := High(Cardinal);
Value := Expected.ToString();
Actual := Cardinal.Parse(Value);
Assert(Expected = Actual);
end;
So I write some unit tests (see below) of which helpers for these types fail in one way or the other:
- Cardinal
- NativeUInt
- Single
- Double
- Extended
These work for the boundary cases:
- SmallInt
- ShortInt
- Integer
- Int64
- NativeInt
- Byte
- Word
- UInt64
- Boolean
- ByteBool
- WordBool
- LongBool
–jeroen
via: Oh nice, in System.SysUtils: “` class function TCardinalHelper.Parse(const…
Read the rest of this entry »
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/10/05
Fails in Delphi XE8 with a nice [dcc32 Fatal Error] dcc32_F2084_C2359.dpr(27): F2084 Internal Error: C2359
It is fixed in Delphi 10.0 Berlin, but of course a C2359 search does not reveal that as Quality Portal is behind a wall. So for future reference the bug: [RSP-13471] Int64 for loops can generate Internal Compiler Error – Embarcadero Technologies. Thanks +Stefan Glienke for mentioning the issue.
program dcc32_F2084_C2359;
type
TNumber = Int64; // UInt64; // fails too; other numeric types do not fail. Fails in a unit as well.
TNumbers = TArray;
TNumberRange = record
strict private
function GetLowerBound: TNumber;
public
function Numbers: TNumbers;
property LowerBound: TNumber read GetLowerBound;
end;
{ TNumberRange }
function TNumberRange.GetLowerBound: TNumber;
begin
Result := Default(TNumber);
end;
function TNumberRange.Numbers: TNumbers;
var
lValue: TNumber;
begin
for lValue := LowerBound to LowerBound do
;
end;
begin
end.
–jeroen
Read the rest of this entry »
Posted in Delphi, Delphi XE8, Development, F2084, Software Development | 1 Comment »
Posted by jpluimers on 2016/10/04
Slay dragons, learn concurrency! Play the cunning Scheduler, exploit flawed programs and defeat the armies of the Parallel Wizard.
Source: The Deadlock Empire
Via: Face the dragon. Learn the ropes of concurrent programming. – Lars Fosdal – Google+
Source code is available and focuses on C#; maybe one day I’ll make a Delphi version: deadlockempire/deadlockempire.github.io: The Deadlock Empire: Slay dragons, learn concurrency!
BTW: a great book (with nice illustrations at both github and kernel.org) is Source: Is Parallel Programming Hard, And, If So, What Can You Do About It? [WayBack]
–jeroen
Posted in .NET, C#, Delphi, Development, Multi-Threading / Concurrency, Software Development | Leave a Comment »
Posted by jpluimers on 2016/09/29
On my TODO list.
References:
This in order to get rid of MSXML dependencies in cross platform Delphi development.
–jeroen
Posted in Continua CI, Continuous Integration, Delphi, Development, DUnit, Software Development | 2 Comments »
Posted by jpluimers on 2016/09/28
Got a very quick response Range combo – Paste.ie – Irish For Pastebin on:
I’m looking for an algorithm that converts a list of integers (for instance of pages to be printed) from this form:1,2,3,4,6,7,8,13,14into1-4,6-8,13-14… – Jeroen Wiert Pluimers – Google+
I’ll write some unit tests soon and make it into a unit for testing.
For now it looks exactly what I need. In addition, I learned how this algorithm is called Range extraction – Rosetta Code and the opposite Range expansion – Rosetta Code.
Basically these lists are the format where a user can enter the range of pages to be printed.
The code by Asbjørn Heid uses a Functional record definition allowing for function binding just like in C++ Boost.Bind [WayBack].
Based on that, I made this changeset: https://bitbucket.org/jeroenp/besharp.net/commits/7205b070a4e6457675a083b78d26659da506fc08
–jeroen
via: I’m looking for an algorithm that converts a list of integers (for instance of…
Posted in Delphi, Development, Software Development | 4 Comments »
Posted by jpluimers on 2016/09/28
A few pieces of Delphi compiler history:
Allen Bauer:
Most notably, the Object Pascal/Delphi compiler is written in mostly C with a smattering of C++, the editor kernel (sans display rendering) and debugger engine (process control/symbol table management) were written in C++. All of which I’ve worked on throughout my 24+ years on that team.
The 16bit compiler was written in pure assembler. The current compiler is written in C. It was derived from an Amiga 68000 Turbo Pascal compatible compiler. It’s never been written in Object Pascal.
That being said, there was an effort several years ago to completely rework/re-architect the compiler. That was done in OP. It just barely got to the “hello world” stage before it was set aside.
Source: The Oracle at Delphi: Set in my ways [WayBack]
–jeroen
Posted in Delphi, Development, History, Software Development | 1 Comment »