Op Mon, 18 Jun 2007, schreef Tom Walsh:

> Heh, if you are reading this then you may know what Metaware is?
> 
> I've a large(!) body of code written over the years under the Metaware
> Professional Pascal compiler.  This code is to be translated to run on the fpc
> compiler.
>
> I wonder if anyone out there has attempted such an endeavor and might give me
> some suggestions, or even some warnings about what I should watch out for?  

From time to time we meet people who are trying to bring new life into old 
Pascal code bases. Generally the experience is that is a lot of work since 
even the lack of small feature might involve rewriting a lot of code. The 
biggest risk with these projects is that the original developer(s) are 
gone and the people doing the port lack the knowledge about the code to do 
it properly. Success means a lot of benefits, like supporting many 
platforms to many new possibilites due to interoperation with other code 
in the Free Pascal world.

I'm not aware of anyone who has ported code from Metaware Pascal.

> I have found that there are some functional differences that Metaware has over
> fpc, one example is the yield() function which returns the intermediate result
> of a function call.

?

> There are a few other functional differences, these
> should be able to be (re)written out.
> 
> Another "interesting feature" is a #define statement which is very much like a
> C macro:
> #define ChMap(A,C) Vt220Map[A] := chr(c)
> There are quite a bit of these '#defines' throughout this source.  I'm
> thinking that the fpc alias is not going to work very well here and that I
> would have to recode these defines as functions / procedures?

Yes, while Free Pascal can do macros, we do not support macro's with 
parameters, please convert them to inline procedures.

> I had considered building a pre-processor to reformat the input to ppcx64 into
> a delphi style construction, but there are enough significant differences in
> source file structure and declarations that would make this a whole lot of
> work.  Probably would also be a headache to maintain such an animal as well
> (yacc?).
> 
> Here is a snippet of the first few lines of a pascal source:

Wow... I doubt I would recognize that code as Pascal if I wasn't told it 
was. Free Pascal implements the UCSD-Pascal derived dialects of the 
language (Turbo Pascal, Delphi, Metrowerks Pascal).

Daniël
 
> ========== begin ================
> export (libdos4);
> 
> { Include MetaWare libraries }
> pragma c_include('implement.pf');
> pragma c_include('language.pf');
> ...
> ...
> pragma c_include('dospriv.inc');
> 
> { C routine package }
> package FromC;
> pragma calling_convention(language.C);
> pragma routine_aliasing_convention(implement.global_aliasing_convention);
> 
> type
> int = LongInt;
> 
> program libdos4_unit;
> 
> with
> defstd4,
> dospriv;
> 
> var
> KeySaveChar: char;
> 
> function DosKeyCharHave:
> boolean;
> begin
>  return(FromC.rdchk(0) = 1);
>  end;
> ========== snip =================
> 
> Anyhow, any thoughts that someone may have would be greatly appreciated!
> 
> TIA,
> 
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net http://cyberiansoftware.com http://openzipit.org
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> 
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to