[fpc-pascal] Metaware

Tom Walsh tom at openhardware.net
Mon Jun 18 16:26:06 CEST 2007


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?  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?

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:

========== 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..."
----------------------------------------------------





More information about the fpc-pascal mailing list