ModelMaker FAQ

Does Model-Maker Pascal Edition support the full Delphi Object Pascal language?

Model-Maker Pascal Edition fully supports the Delphi 5-7, 2007-2010 and Delphi XE-XE8 Pascal class related syntax - with the restrictions on imported code as described in the user manual. The user manual also explains how you can work around most restrictions. Here's a summary of these restrictions:

  • class helpers, record helpers and dispinterfaces are not supported
  • indexer properties with duplicate names are not supported. The importer will emit warnings.
  • Compiler directives in the class interface and method declarations are not supported. Compiler directives cannot be entered inside ModelMaker and during import they are treated as comments. The importer emits warnings. Exception: non-nested member source regions are optionally imported / generated
  • Using the identifier escape character has some restrictions.
  • Using the qualified names has some restrictions.
  • Pure assembly methods (starting the main method's block with asm rather than begin) are not supported. Assembly inside a method is supported.
  • Property index specifiers cannot use expressions but must use a constant or numeric value.
  • For import, a class must reside entirely in a single file. Include files which contain part of the class's interface or implementation are not supported.

All code inside a method is not interpreted and no restrictions apply. All non class-related code goes in the "module code" which is uninterpreted no restrictions apply there either.

Why are my Delphi methods not imported correct in Model-Maker?

After importing code for some methods there is no code while others contain too much code. What's happening here?

This is most likely caused by missing end's in the code or by compiler directives. Compiler directives around method implementations are not supported. These can be solved by placing the directives inside the method:

{$IFDEF DEMO}
procedure TSample.Action;
begin
end;
{$ELSE}
procedure TSample.Action;
begin
  // do something useful
end;
{$ENDIF}

The code above won't be imported correct, but can be replaced by the following code which imports fine:

procedure TSample.Action;
begin
{$IFDEF DEMO}
{$ELSE}
  // do something useful
{$ENDIF}
end;

The Model-Maker importer matches begin..end try..end, case..end pairs etc. to locate methods. Because conditional defines are not interpreted, using conditional defines you can create code that will compile correct but will not import correct. In fact The Delphi IDE back ground compiler uses a similar mechanism and will not be able to function properly either when inserting new methods in code completion or creating a new event handler.

This code for example will confuse the importer's begin end matching end the method will not import correct.

procedure TSample.Action;
{$IFDEF DEMO}
var
  S: string;
begin
  S := 'Demo';
  ShowMessage(S);
{$ELSE}
begin
{$ENDIF}
end;

You can replace the previous code by the following code which will import correct and as an side effect allows the Delphi IDE to stay on track too:

procedure TSample.Action;
{$IFDEF DEMO}
var
  S: string;
{$ENDIF}
begin
{$IFDEF DEMO}
  S := 'Demo';
  ShowMessage(S);
{$ELSE}
{$ENDIF}
end;