Porting from Dec Pascal to GPC

Frank Heckenbach ih8mj at fjf.gnu.de
Fri Mar 4 06:38:45 CET 2005


Angelo.Fumagalli at alcatel.it wrote:

> we are going to port thousand and thousand of Dec Pascal modules
> to GPC in order to migrate software from VMS to Linux platform.
>
> We know that here there are  the maximum experts to ask for, so we
> would like to ask you wich is the better model to migrate Dec
> environment modules maintaining the structure in terms of files
> and references, without having to completely change the source
> code, without splitting the procedure declarations and moving them
> in the library implementation modules.

With EP modules, you can put interface and implementation parts into
different files which may be more suitable in your case (while
usually, I don't recommend it).

> Have you some documentation which describes how to porting from
> Dec pascal to GPC that you could supply us?

Not AFAIK -- I haven't used this dialect.

> A litte DEC Pascal environment example:
> 
> 1.  environmet file me.pas
> 
> MODULE ME;
> procedure p1; extern;
> procedure p2; extern;
> .......
> procedure pn; extern;
> 
> END.
> 
> 2. library module m1.pas .. mn.pas
>     NOTE:: typically all library modules which implement global procedures defined in the environment file me.pas are in the following format:
> 
> [INHERIT('me')]
> MODULE m1;
> [global]
> procedure p1;
> begin
> ....
> end;
> END.
> 
> 3. Program module p.pas:
> 
> [INHERIT('me')]
> PROGRAM P;
> begin
>   p1;
>   p2;
>   ...
>   pn;
> END.
> 
> Modules migration to GPC (is this one the only possible migration?):
> 
> 1.  library modules m1.pas .. mn.pas
> 
> module m1 interface;
> export m1 = all;
> procedure p1; forward;
> end.
> module m1 implementation;
>   procedure p1;
>   begin
>   ...
>   end;
> end.

The `forward;' is superfluous (actually invalid according to EP;
currently GPC allows it; I'll have to check if some other dialect
requires it, otherwise I think we'll forbid it).

Simplified form of modules (though this might not help you, if you
want interface and implementation in separate files):

module m1;
export m1 = all;
procedure p1;
end;

procedure p1;
begin

end;

end.

UCSD/BP style unit:

unit m1;

interface

procedure p1;

implementation

procedure p1;
begin

end;

end.

> Otherwise, it's possible to have the same DEC Pascal file/module
> structure? I mean only one interface module (me.pas) which is
> imported/used in all library and Program modules?

You mean a single interface for several modules (like C headers)?
This isn't supported by either modules or units.

PS: Please no HTML mails!

Frank

-- 
Frank Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE  D101 CD02 4C9D 0FE0 E5E8




More information about the Gpc mailing list