portable source (from Borland to GPC, FPC...) 
Author Message
 portable source (from Borland to GPC, FPC...)

Greetings

I run into trouble with my source code firstly developed for Turbo
Pascal 7, when compileing under GPC. I am useing GPC 2.0 on GCC 2.72,
DJDEV 2.01, BNU 2.81, the following error and warning messages occured
on the code:

in the interface section:

function menux : byte;

error : type name expected, identifyer 'byte' given;

in the implementation section:

function menux : byte;

error : type name expected, identifyer 'byte' given; (the same)

in function Menux:

var
   tmenu : pmenu;
   t : byte;

error : type name expected, identifyer 'byte' given;

So on second try i thought i'd better not use byte length variables
and replace them with integer.

But still warnnings came in on the following.
I have this type defined in the interface section:

type
    str20 = string[20];
    str40 = string[40];
    pmenue = ^menue;
    psubs = ^subs;
    menue = record
          caption : str20;
          index : integer;
          hint : str40;
          nextmenu : pmenue;
          prevmenu : pmenue;
          firstsub : psubs;
    end;
    subs = record
         caption : str20;
         index : integer;
         hint : str40;
         nextsub : psubs;
         prevsub : psubs;
    end;

Warrnings in the implementation section inside functions:

in function Newmenu:

function newmenu (cap : str20; hin : str40) : pmenue;

var
   tmenu, lmenu : pmenue;
   t : integer;

begin
     if firstmenu = nil then begin
        tmenu := new (pmenue);

warning : expression used as a statement -- value is ignored

...
        tmenu^.nextmenu := new (pmenue);

warning : expression used as a statement -- value is ignored

Does this suppose to mean that pointer tmenu does not get the address
of the new allocated space? If so, what is tmenu equal to, nil?

Does GPC has a GPC definition so condicional compileing can be done?
Like FPC ex. {$IFDEF FPC) {bla bla} {$ENDIF} and where can i find the
inline source switches/directives for GPC?

Vasko



Sun, 23 Oct 2005 15:55:44 GMT  
 portable source (from Borland to GPC, FPC...)


Quote:
>I run into trouble with my source code firstly developed for Turbo
>Pascal 7, when compileing under GPC. I am useing GPC 2.0 on GCC 2.72,
>DJDEV 2.01, BNU 2.81, the following error and warning messages occured
>on the code:

This sounds like a very old version of gpc and the compiler has improved
greatly over the intervening period.  I strongly recommend getting the
latest version (2.1) from <http://www.gnu-pascal.de> before going any
further.
--
Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
Cramlington, Northumberland, England, NE23 6EW.
Phone: 01670-712624.  Fax: 0870-0526314.
Web site: <http://www.tynecomp.co.uk>.


Sun, 23 Oct 2005 18:29:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to keep the code portable? (FPC)

2. FPC:problem with printing from fpc programs

3. FPC: translate execvp from c to FPC

4. Free Borland Pascal/Delphi UNZIP source code (UNITs and DLL)

5. Need to source Borland C++ V3.1

6. borland RTL sources?

7. How do I convert Borland Pascal source files to C

8. Portable databases

9. Using SQl to be portable to any database

10. delphi/sql apps portable (stringtables)?

11. 12V portable electronic Cooler/warmers

12. more than 640K of memory -- portable solution

 

 
Powered by phpBB® Forum Software