[TurboPascal, Dev-Pas] problem with longint and unexpected end of file

Hello!

I was looking for the answer here but I couldn't find: http://www.freepascal.org/port.var .

I've got old code in Turbo Pascal and I try to run it on Dev-Pascal 1.9.2. (I also tried Lazarus application, but there was "Error. Project raised exception class 'External: SIGSEGV'.").

[code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Win32 for i386
Compiling f:intern26turb~1programmain1.pas
main1.pas(1,2) Warning: Unsupported switch $N
Compiling main2.pas
main2.pas(1,2) Warning: Unsupported switch $N
main2.pas(308,15) Error: call by var parameters have to match exactly: Got LONGINT expected SMALLINT
main2.pas(645,76) Warning: Comment level 2 found
main2.pas(843,3) Warning: Comment level 2 found
main2.pas(643,2) Fatal: Unexpected end of file[/code]

I look at these two lines:
[code]308: InitGraph(ster,tryb,path);
52: ster:integer=VGA;[/code]

I changes line 52.
[code]52: ster:smallint=VGA;[/code]
I also tried:
[code]52: ster:shortint=VGA;[/code]
But neither of them can help and there's all the time the same error: Got LONGINT expected SMALLINT.

And the other thing, that is "unexpected end of file".
End of the file is as follows:
[code] Resume
end
end;


end .[/code]

How to get rid of those two errors?

Greetings!

Comments

  • Did you include [b]{$mode tp}[/b] and [b]{$asmmode intel}[/b] as first lines in your code ? Also check the comments, most likely that's what causing the unexpected end of file error. Doesn't hurt to upgrade to the latest FP as well.
  • Hello!

    I got rid of some problems with changing code from Turbo Pascal (from eighteen years ago) to Free Pascal (Dev-Pascal). Those problems were changing integer into smallint and erasing nested comments.

    Now I've got problems with labels.

    All results of "200", "label" and "goto":
    [code]69: menu1[4]:='Library ';
    732: procedure axesimu;
    733: label 0200;
    744: case vv of
    747: 3: Goto 0200;
    881: 200: window(1,1,80,25); ClrScr;
    884: procedure TwoAxles;
    885:label 100;
    1025: if (zn='N') or (zn='n') then goto 100;
    1752: procedure library;
    1871: 4: library;[/code]

    Without any changes:
    [code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:dev-pascompany2trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(401,5) Note: Local variable EM1 not used
    02trc~1.pas(881,1) Error: Identifier not found 200
    02trc~1.pas(881,4) Error: Illegal expression
    02trc~1.pas(881,4) Fatal: Syntax error, ; expected but : found[/code]

    After adding to the second line {$GOTO ON}
    [code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:dev-pascompany2trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(882,1) Error: Identifier not found 200
    02trc~1.pas(882,4) Error: Illegal expression
    02trc~1.pas(882,4) Fatal: Syntax error, ; expected but : found[/code]

    After changing from
    [code]200: window(1,1,80,25); ClrScr;[/code]
    to
    [code]window(1,1,80,25); ClrScr;[/code]
    compilation errors:
    [code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:dev-pascompany2trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(883,1) Error: Label used but not defined 0200
    02trc~1.pas(1750,11) Fatal: Syntax error, identifier expected but LIBRARY found[/code]

    After changing into:
    [code] label 200; window(1,1,80,25); ClrScr;[/code]
    errors:
    [code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:dev-pascompany2trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(882,8) Error: Illegal expression
    02trc~1.pas(882,8) Error: Illegal expression
    02trc~1.pas(882,8) Fatal: Syntax error, ; expected but ordinal const found[/code]

    After changing into
    [code]window(1,1,80,25); ClrScr;[/code]
    And changing 734:
    label 0200;
    into
    label lab200;
    And 748:
    3: Goto 0200;
    into
    3: Goto lab200;
    And 886:
    label 100;
    into
    label lab100;
    And 1026:
    if (zn='N') or (zn='n') then goto 100;
    into
    if (zn='N') or (zn='n') then goto lab100;
    And 1069
    100: ClrScr;
    into
    label lab100; ClrScr;
    The errors:
    [code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:dev-pascompany2trc~1.pas
    02trc~1.pas(1,2) Warning: Unsupported switch $N
    02trc~1.pas(402,5) Note: Local variable EM1 not used
    02trc~1.pas(883,1) Error: Label used but not defined LAB200
    02trc~1.pas(1069,7) Error: Illegal expression
    02trc~1.pas(1069,7) Error: Illegal expression
    02trc~1.pas(1069,7) Fatal: Syntax error, ; expected but identifier LAB100 found[/code]

    The last one thing which I tried was to add at the beginning of the code three things (on the file with no changes):
    [code]{$GOTO ON}
    {$mode tp}
    {$asmmode intel}[/code]
    And errors:
    [code]Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
    Copyright (c) 1993-2002 by Florian Klaempfl
    Target OS: Win32 for i386
    Compiling f:dev-pascompany rc.pas
    trc.pas(1,2) Warning: Unsupported switch $N
    trc.pas(404,5) Note: Local variable EM1 not used
    trc.pas(885,1) Error: Label used but not defined 0200
    trc.pas(1752,11) Fatal: Syntax error, identifier expected but LIBRARY found[/code]

    Greetings!
  • An upgrade to the latest FP will solve the $N switch issue, not important at all since all newer CPU's have numeric co-processor. Labels must be declared before used, eg.[code]program xyz;

    label _name_; { <-- declaration, once per label }

    begin
    {...}
    _name_: { <-- doesn't need the [b]label[/b] word}
    {...}
    goto _name_; { jump to label }
    {...}
    end.[/code]As for the last error, IMO the naming could be the cause for the conflict...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories